merged asterix_stabilization_temp_missing_tests branches back to stabilization

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@1342 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/data/temporal/temporalData.json b/asterix-app/data/temporal/temporalData.json
index 520fd4b..5b3a0f5 100644
--- a/asterix-app/data/temporal/temporalData.json
+++ b/asterix-app/data/temporal/temporalData.json
@@ -1,3 +1,3 @@
-{"id": "001", "dateField": date("-2012-12-12"), "dateFieldPlus": date("0990-01-01"), "timeField": time("23:49:12.39Z"), "timeFieldPlus": time("03:23:12.2"), "datetimeField": datetime("2012-12-12T00:00:00.001"), "datetimeFieldPlus": datetime("-00130810T221015398"), "durationField": duration("P20Y19DT3H74M23.34S"), "durationFieldPlus": duration("-P2MT4M300.68S"), "intervalField": dtinterval("2012-12-12T00:00:00.001,20130810T221015398") }
-{"id": "002", "datetimeField": datetime("19201220T232918478") }
-{"id": "003", "intervalPlus": tinterval("19:23:32.328Z,23:20:20") }
\ No newline at end of file
+{"id": "001", "dateField": date("-2012-12-12"), "dateFieldPlus": date("0990-01-01"), "timeField": time("23:49:12.39Z"), "timeFieldPlus": time("03:23:12.2"), "datetimeField": datetime("2012-12-12T00:00:00.001"), "datetimeFieldPlus": datetime("-00130810T221015398"), "durationField": duration("P20Y19DT3H74M23.34S"), "durationFieldPlus": duration("-P2MT4M300.68S"), "intervalField": interval-datetime("2012-12-12T00:00:00.001,20130810T221015398") }
+{"id": "002", "timeField": time("12:12:12.219+08:00"), "timeField2": time("13:13:13.321-08:00"), "datetimeField": datetime("19201220T232918478-1200"), "intervalField": interval-time("12:29:30+08:00, 235959999-0800") }
+{"id": "003", "durationField": duration("-P27Y48DT2400H"), "datetimeField": datetime("-0290-03-23T00:59:48.999+07:00"), "intervalField": interval-date("-2012-03-17, 2013-04-01"), "intervalPlus": interval-time("19:23:32.328Z,23:20:20") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/time_order.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/time_order.aql
index ba0d211..df9966e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/comparison/time_order.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/time_order.aql
@@ -7,7 +7,7 @@
 let $t1 := time("13:00:00.382-10:00")
 let $t2 := time("23:59:59.999Z")
 let $t3 := time("22:00:00+03:00")
-let $t4 := time("00:00:00.00Z")
+let $t4 := time("00:00:00.00")
 let $t5 := time("00:00:00.00-02:00")
 let $t6 := time("00:00:00.47+04:00")
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/date_01.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/date_01.aql
index 9bbfb9d..821854c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/date_01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/date_01.aql
@@ -12,6 +12,8 @@
 let $c6 := date("-2043-11-19")
 let $c7 := date("-19280329")
 let $c8 := date("19280329")
+let $c9 := date("19000228")
+let $c10 := date("20000229")
 
-return {"date1": $c1, "date2": $c2, "date3": $c3, "date4": $c4, "date5": $c5, "date6": $c6, "date7": $c7, "date8": $c8}
+return {"date1": $c1, "date2": $c2, "date3": $c3, "date4": $c4, "date5": $c5, "date6": $c6, "date7": $c7, "date8": $c8, "date9": $c9, "date10": $c10}
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/interval.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/interval.aql
index 71e90fa..e116984 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/interval.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/interval.aql
@@ -5,10 +5,10 @@
 write output to nc1:"rttest/constructor_interval.adm";
 
 let $itv1 := interval-from-date("2010-10-30", "2012-10-21")
-let $itv2 := interval-from-time("03:04:05.678", "232425267")
-let $itv3 := interval-from-datetime("-1987-11-19T02:43:57.938", "1999-11-12T12:49:35.948")
+let $itv2 := interval-from-time("03:04:05.678-11:00", "232425267+0200")
+let $itv3 := interval-from-datetime("-1987-11-19T02:43:57.938+08:00", "19991112T124935948-0700")
 let $itv4 := interval-start-from-date("0001-12-27", "P3Y394DT48H398.483S")
-let $itv5 := interval-start-from-time("20:03:20.948", "PT48M389.938S")
+let $itv5 := interval-start-from-time("20:03:20.948", "P60DT48M389.938S")
 let $itv6 := interval-start-from-datetime("-2043-11-19T15:32:39.293", "P439Y3M20DT20H39M58.949S")
 
 return {"interval1": $itv1, "interval2": $itv2, "interval3": $itv3, "interval4": $itv4, "interval5": $itv5, "interval6": $itv6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/time_01.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/time_01.aql
index 4a040a1..995215d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/time_01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/time_01.aql
@@ -14,6 +14,6 @@
 let $c8 := time("12:59:00.01-01:00")
 let $c9 := time("12:59:00.019-01:00")
 let $c10 := time("12590001-0100")
-let $c11 := time("125900019-0100")
+let $c11 := time("125900019+0100")
 return {"time1": $c1, "time2": $c2, "time3": $c3, "time4": $c4, "time5": $c5, "time6": $c6, "time7": $c7, "time8": $c8, "time9": $c9, "time10": $c10, "time11": $c11}
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/abs3.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/abs3.aql
index 4364409..8e947de 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/abs3.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/abs3.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-abs($c0), "d1": numeric-abs($c1),"d2": numeric-abs($c2),
-        "d3": numeric-abs($c3),"d4": numeric-abs($c4),"d5": numeric-abs($c5), "d6": numeric-abs($c6)}
+        "d3": numeric-abs($c3),"d4": numeric-abs($c4),"d5": numeric-abs($c5), "d6": numeric-abs($c6), "d7": numeric-abs($c7)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/abs4.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/abs4.aql
index b2db5fd..03d145f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/abs4.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/abs4.aql
@@ -5,4 +5,4 @@
 write output to nc1:"rttest/numeric_abs4.adm";
 
 let $c0 := int8("-20")
-return {"f0": numeric-abs($c0), "f1": numeric-abs(-1.11),"f2": numeric-abs(12.9), "f3": numeric-abs(1.11)}
+return {"f0": numeric-abs($c0), "f1": numeric-abs(-1.11),"f2": numeric-abs(12.9), "f3": numeric-abs(1.11), "f4": numeric-abs(null)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling3.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling3.aql
index 67ad9db..a47d696 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling3.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling3.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-ceiling($c0), "d1": numeric-ceiling($c1),"d2": numeric-ceiling($c2),
-        "d3": numeric-ceiling($c3),"d4": numeric-ceiling($c4),"d5": numeric-ceiling($c5), "d6": numeric-ceiling($c6)}
+        "d3": numeric-ceiling($c3),"d4": numeric-ceiling($c4),"d5": numeric-ceiling($c5), "d6": numeric-ceiling($c6), "d7": numeric-ceiling($c7)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling4.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling4.aql
index a90851c..860c586 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling4.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/ceiling4.aql
@@ -5,4 +5,4 @@
 write output to nc1:"rttest/numeric_ceiling4.adm";
 
 let $c0 := int8("-20")
-return {"f0": numeric-ceiling($c0), "f1": numeric-ceiling(-1.11),"f2": numeric-ceiling(12.9), "f3": numeric-ceiling(1.11)}
+return {"f0": numeric-ceiling($c0), "f1": numeric-ceiling(-1.11),"f2": numeric-ceiling(12.9), "f3": numeric-ceiling(1.11), "f4": numeric-ceiling(null)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/floor3.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/floor3.aql
index d975dfc..9478448 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/floor3.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/floor3.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-floor($c0), "d1": numeric-floor($c1),"d2": numeric-floor($c2),
-        "d3": numeric-floor($c3),"d4": numeric-floor($c4),"d5": numeric-floor($c5), "d6": numeric-floor($c6)}
+        "d3": numeric-floor($c3),"d4": numeric-floor($c4),"d5": numeric-floor($c5), "d6": numeric-floor($c6), "d7": numeric-floor($c7)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/floor4.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/floor4.aql
index eae917d..7d51da7 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/floor4.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/floor4.aql
@@ -5,4 +5,4 @@
 write output to nc1:"rttest/numeric_floor4.adm";
 
 let $c0 := int8("-20")
-return {"f0": numeric-floor($c0), "f1": numeric-floor(-1.11),"f2": numeric-floor(12.9), "f3": numeric-floor(1.11)}
+return {"f0": numeric-floor($c0), "f1": numeric-floor(-1.11),"f2": numeric-floor(12.9), "f3": numeric-floor(1.11), "f4": numeric-floor(null)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even23.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even23.aql
index cbbcd10..5d401bd 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even23.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even23.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-round-half-to-even2($c0,2), "d1": numeric-round-half-to-even2($c1,2),"d2": numeric-round-half-to-even2($c2,3),
-        "d3": numeric-round-half-to-even2($c3,4),"d4": numeric-round-half-to-even2($c4,5),"d5": numeric-round-half-to-even2($c5,6), "d6": numeric-round-half-to-even2($c6,0)}
+        "d3": numeric-round-half-to-even2($c3,4),"d4": numeric-round-half-to-even2($c4,5),"d5": numeric-round-half-to-even2($c5,6), "d6": numeric-round-half-to-even2($c6,0), "d7": numeric-round-half-to-even2($c7, -2)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even24.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even24.aql
index 8fe21fe..a112281 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even24.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even24.aql
@@ -10,5 +10,5 @@
 let $c2 := double("3.567812E+3")
 let $c3 := double("4.7564E-3")
 let $c4 := double("35612.25")
-return {"d0": numeric-round-half-to-even2($c0,2), "d1": numeric-round-half-to-even2($c1,2),"d2": numeric-round-half-to-even2($c2,2),
-        "d3": numeric-round-half-to-even2($c3,2),"d4": numeric-round-half-to-even2($c4,-2)}
+return {"d0": numeric-round-half-to-even2($c0, 2), "d1": numeric-round-half-to-even2($c1, 2),"d2": numeric-round-half-to-even2($c2, 2),
+        "d3": numeric-round-half-to-even2($c3, 2),"d4": numeric-round-half-to-even2($c4, -2), "d5": numeric-round-half-to-even2(null, -2)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even3.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even3.aql
index 6d10ae1..8024e68 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even3.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even3.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-round-half-to-even($c0), "d1": numeric-round-half-to-even($c1), "d2": numeric-round-half-to-even($c2),
-        "d3": numeric-round-half-to-even($c3), "d4": numeric-round-half-to-even($c4), "d5": numeric-round-half-to-even($c5), "d6": numeric-round-half-to-even($c6)}
+        "d3": numeric-round-half-to-even($c3), "d4": numeric-round-half-to-even($c4), "d5": numeric-round-half-to-even($c5), "d6": numeric-round-half-to-even($c6), "d7": numeric-round-half-to-even($c7)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even5.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even5.aql
index b89388f..bfa308f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even5.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round-half-to-even5.aql
@@ -5,4 +5,4 @@
 write output to nc1:"rttest/numeric_round-half-to-even5.adm";
 
 let $c0 := int8("-20")
-return {"f0": numeric-round-half-to-even($c0), "f1": numeric-round-half-to-even(-1.5),"f2": numeric-round-half-to-even(12.5), "f3": numeric-round-half-to-even(1.5)}
+return {"f0": numeric-round-half-to-even($c0), "f1": numeric-round-half-to-even(-1.5),"f2": numeric-round-half-to-even(12.5), "f3": numeric-round-half-to-even(1.5), "f4": numeric-round-half-to-even(null)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round3.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round3.aql
index 54e2685..c5b752a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round3.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round3.aql
@@ -12,5 +12,6 @@
 let $c4 := double("-INF")
 let $c5 := double("-0.0")
 let $c6 := double("0.0")
+let $c7 := double("-6223372036854775807.89239")
 return {"d0": numeric-round($c0), "d1": numeric-round($c1),"d2": numeric-round($c2),
-        "d3": numeric-round($c3),"d4": numeric-round($c4),"d5": numeric-round($c5), "d6": numeric-round($c6)}
+        "d3": numeric-round($c3),"d4": numeric-round($c4),"d5": numeric-round($c5), "d6": numeric-round($c6), "d7": numeric-round($c7)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/round4.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/round4.aql
index 5dccfd7..9c2faf3 100644
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/round4.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/numeric/round4.aql
@@ -5,4 +5,4 @@
 write output to nc1:"rttest/numeric_round4.adm";
 
 let $c0 := int8("-20")
-return {"f0": numeric-round($c0), "f1": numeric-round(-1.11),"f2": numeric-round(12.9), "f3": numeric-round(1.11)}
+return {"f0": numeric-round($c0), "f1": numeric-round(-1.11),"f2": numeric-round(12.9), "f3": numeric-round(1.11), "f4": numeric-round(null)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/matches11.aql b/asterix-app/src/test/resources/runtimets/queries/string/matches11.aql
index 1e96b5f..8b9d3be 100644
--- a/asterix-app/src/test/resources/runtimets/queries/string/matches11.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/string/matches11.aql
@@ -11,6 +11,8 @@
 matches("hello","helllo"),
 matches("hello"," "),
 matches(null,"hello"),
+matches(null, ""),
+matches(null, null),
 matches("hello","[^a-z]")]
 return $a
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/replace1.aql b/asterix-app/src/test/resources/runtimets/queries/string/replace1.aql
index 3a9e932..419fe4b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/string/replace1.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/string/replace1.aql
@@ -7,4 +7,6 @@
 let $c1 := replace("abracadabra", "a", "")
 let $c2 := replace("abracadabra", "a(.)", "a$1$1")
 let $c3 := replace("darted", "^(.*?)d(.*)$", "$1c$2")
-return {"result1": $c1, "result2": $c2, "result3": $c3}
+let $c4 := replace("hello", "", "-")
+let $c5 := replace(null, "*", "-")
+return {"result1": $c1, "result2": $c2, "result3": $c3, "result4": $c4, "result5": $c5}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/calendar_duration.aql b/asterix-app/src/test/resources/runtimets/queries/temp/calendar_duration.aql
deleted file mode 100644
index 67360ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/temp/calendar_duration.aql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Description      :   Check the calendar-duration functions
- * Expected Result  :   Success
- * Date             :   15th Oct, 2012
- */
-
-drop dataverse test if exists;
-create dataverse test;
-use dataverse test;
-
-write output to nc1:"rttest/temp_calendar_duration.adm";
-
-let $t1 := datetime("1987-11-19T23:49:23.938")
-let $t2 := date("-1328-10-23")
-let $dr1 := duration("P7382DT39283M3921.329S")
-let $dr2 := duration("-PT63H398212M3219.328S")
-let $dr3 := duration("P1Y90M")
-let $dr4 := duration("-P3Y89M4089DT47382.983S")
-let $cdr1 := calendar-duration-from-datetime($t1, $dr1)
-let $cdr2 := calendar-duration-from-datetime($t1, $dr2)
-let $cdr3 := calendar-duration-from-datetime($t1, $dr3)
-let $cdr4 := calendar-duration-from-datetime($t1, $dr4)
-let $cdr5 := calendar-duration-from-date($t2, $dr1)
-let $cdr6 := calendar-duration-from-date($t2, $dr2)
-let $cdr7 := calendar-duration-from-date($t2, $dr3)
-let $cdr8 := calendar-duration-from-date($t2, $dr4)
-
-return { "cduration1":$cdr1, "cduration2":$cdr2, "cduration3":$cdr3, "cduration4":$cdr4, "cduration5":$cdr5, "cduration6":$cdr6, "cduration7":$cdr7, "cduration8":$cdr8 }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/accessors.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/accessors.aql
similarity index 95%
rename from asterix-app/src/test/resources/runtimets/queries/temp/accessors.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/accessors.aql
index 9cc9f8d..7830438 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/accessors.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/accessors.aql
@@ -8,7 +8,7 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_accessors.adm";
+write output to nc1:"rttest/temporal_accessors.adm";
 
 let $c1 := date("2010-10-30")
 let $c2 := datetime("1987-11-19T23:49:23.938")
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/adjust_timezone.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/adjust_timezone.aql
similarity index 88%
rename from asterix-app/src/test/resources/runtimets/queries/temp/adjust_timezone.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/adjust_timezone.aql
index 9f6c60e..13c2487 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/adjust_timezone.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/adjust_timezone.aql
@@ -8,7 +8,7 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_adjust_timezone.adm";
+write output to nc1:"rttest/temporal_adjust_timezone.adm";
 
 let $t1 := time("20:15:10.327")
 let $dt1 := datetime("2010-10-23T01:12:13.329Z")
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration.aql
new file mode 100644
index 0000000..2d0c91b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration.aql
@@ -0,0 +1,52 @@
+/*
+ * Description      :   Check the calendar-duration functions
+ * Expected Result  :   Success
+ * Date             :   15th Oct, 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/temporal_calendar_duration.adm";
+
+let $t1 := datetime("1987-11-19T23:49:23.938")
+let $t2 := date("-1328-10-23")
+let $dr1 := duration("P7382DT39283M3921.329S")
+let $dr2 := duration("-PT63H398212M3219.328S")
+let $dr3 := duration("P1Y90M")
+let $dr4 := duration("-P3Y89M4089DT47382.983S")
+let $cdr1 := calendar-duration-from-datetime($t1, $dr1)
+let $dt1 := add-datetime-duration($t1, $dr1)
+let $dtt1 := add-datetime-duration($t1, $cdr1)
+let $c1 := $dt1 = $dtt1
+let $cdr2 := calendar-duration-from-datetime($t1, $dr2)
+let $dt2 := add-datetime-duration($t1, $dr2)
+let $dtt2 := add-datetime-duration($t1, $cdr2)
+let $c2 := $dt2 = $dtt2
+let $cdr3 := calendar-duration-from-datetime($t1, $dr3)
+let $dt3 := add-datetime-duration($t1, $dr3)
+let $dtt3 := add-datetime-duration($t1, $cdr3)
+let $c3 := $dt3 = $dtt3
+let $cdr4 := calendar-duration-from-datetime($t1, $dr4)
+let $dt4 := add-datetime-duration($t1, $dr4)
+let $dtt4 := add-datetime-duration($t1, $cdr4)
+let $c4 := $dt4 = $dtt4
+let $cdr5 := calendar-duration-from-date($t2, $dr1)
+let $dt5 := add-date-duration($t2, $dr1)
+let $dtt5 := add-date-duration($t2, $cdr5)
+let $c5 := $dt5 = $dtt5
+let $cdr6 := calendar-duration-from-date($t2, $dr2)
+let $dt6 := add-date-duration($t2, $dr2)
+let $dtt6 := add-date-duration($t2, $cdr6)
+let $c6 := $dt6 = $dtt6
+let $cdr7 := calendar-duration-from-date($t2, $dr3)
+let $dt7 := add-date-duration($t2, $dr3)
+let $dtt7 := add-date-duration($t2, $cdr7)
+let $c7 := $dt7 = $dtt7
+let $cdr8 := calendar-duration-from-date($t2, $dr4)
+let $dt8 := add-date-duration($t2, $dr4)
+let $dtt8 := add-date-duration($t2, $cdr8)
+let $c8 := $dt8 = $dtt8
+
+return { "cduration1":$cdr1, "c1":$c1, "cduration2":$cdr2, "c2":$c2, "cduration3":$cdr3, "c3":$c3, "cduration4":$cdr4, "c4":$c4, "cduration5":$cdr5, "c5":$c5, "cduration6":$cdr6, "c6":$c6, "cduration7":$cdr7, "c7":$c7, "cduration8":$cdr8, "c8":$c8 }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/date_functions.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions.aql
similarity index 72%
rename from asterix-app/src/test/resources/runtimets/queries/temp/date_functions.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/date_functions.aql
index 310fa43..4f9ef5c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/date_functions.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions.aql
@@ -7,7 +7,7 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_date_functions.adm";
+write output to nc1:"rttest/temporal_date_functions.adm";
 
 let $d1 := date-from-unix-time-in-days(15600)
 let $dt1 := datetime("1327-12-02T23:35:49.938Z")
@@ -16,9 +16,11 @@
 let $d3 := date-from-datetime($dt2)
 let $dr1 := duration("-P2Y1M90DT30H")
 let $d4 := add-date-duration($d1, $dr1)
+let $c1 := $d1 = add-date-duration($d4, subtract-date($d1, $d4))
 let $dr2 := duration("P300Y900MT360000M")
 let $d5 := add-date-duration($d2, $dr2)
+let $c2 := $d2 = add-date-duration($d5, subtract-date($d2, $d5))
 let $dr3 := subtract-date($d5, $d2)
 let $dr4 := subtract-date($d4, $d1)
 
-return { "date1" : $d1, "date2" : $d2, "date3" : $d3, "date4" : $d4, "date5" : $d5, "duration1" : $dr3, "duration2" : $dr4  }
\ No newline at end of file
+return { "date1" : $d1, "date2" : $d2, "date3" : $d3, "date4" : $d4, "date5" : $d5, "duration1" : $dr3, "duration2" : $dr4, "c1" : $c1, "c2" : $c2  }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/datetime_functions.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions.aql
similarity index 70%
rename from asterix-app/src/test/resources/runtimets/queries/temp/datetime_functions.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions.aql
index a70c9f2..cc68789 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/datetime_functions.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions.aql
@@ -8,13 +8,14 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_datetime_functions.adm";
+write output to nc1:"rttest/temporal_datetime_functions.adm";
 
 let $dt1 := datetime-from-unix-time-in-ms(956007429)
 let $d1 := date("1327-12-02")
-let $t1 := time("23:35:49.938Z")
+let $t1 := time("15:35:49.938-0800")
 let $dt2 := datetime-from-date-time($d1, $t1)
 let $dr1 := subtract-datetime($dt2, $dt1)
 let $dt3 := add-datetime-duration($dt1, $dr1)
+let $c1 := $dt1 = add-datetime-duration($dt3, subtract-datetime($dt1, $dt3))
 
-return { "datetime1" : $dt1, "datetime2" : $dt2, "datetime3" : $dt3, "duration1" : $dr1 }
\ No newline at end of file
+return { "datetime1" : $dt1, "datetime2" : $dt2, "datetime3" : $dt3, "duration1" : $dr1, "c1" : $c1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/insert_from_delimited_ds.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_delimited_ds.aql
similarity index 91%
rename from asterix-app/src/test/resources/runtimets/queries/temp/insert_from_delimited_ds.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_delimited_ds.aql
index 4520f46..344db02 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/insert_from_delimited_ds.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_delimited_ds.aql
@@ -16,7 +16,7 @@
   durationField: duration
 }
 
-write output to nc1:"rttest/temp_insert_from_delimited_ds.adm";
+write output to nc1:"rttest/temporal_insert_from_delimited_ds.adm";
 
 create external dataset testds(testtype)
 using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/insert_from_ext_ds.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds.aql
similarity index 92%
rename from asterix-app/src/test/resources/runtimets/queries/temp/insert_from_ext_ds.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds.aql
index 5813696..0a3903f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/insert_from_ext_ds.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds.aql
@@ -17,7 +17,7 @@
   intervalField: interval?
 }
 
-write output to nc1:"rttest/temp_insert_from_ext_ds.adm";
+write output to nc1:"rttest/temporal_insert_from_ext_ds.adm";
 
 create external dataset testds(testtype)
 using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/interval_functions.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_functions.aql
similarity index 76%
rename from asterix-app/src/test/resources/runtimets/queries/temp/interval_functions.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/interval_functions.aql
index a29f7f5..5831468 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/interval_functions.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_functions.aql
@@ -8,11 +8,11 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_interval_functions.adm";
+write output to nc1:"rttest/temporal_interval_functions.adm";
 
 let $itv1 := interval-from-date("2010-10-30", "2010-12-21")
 let $itv2 := interval-from-date("2011-10-30", "2012-10-21")
-let $itv3 := interval-from-date("2010-06-30", "2013-01-01")
+let $itv3 := interval-from-date("2010-12-21", "2013-01-01")
 let $blnBefore1 := interval-before($itv1, $itv2)
 let $blnAfter1 := interval-after($itv2, $itv1)
 let $blnBefore2 := interval-before($itv1, $itv3)
@@ -28,11 +28,11 @@
 
 let $itv7 := interval-from-time("12:32:38", "20:29:20")
 let $itv8 := interval-from-time("17:48:19", "22:19:49")
-let $itv9 := interval-from-time("01:32:49", "12:33:00")
+let $itv9 := interval-from-time("01:32:49", "17:48:19")
 let $blnOverlaps1 := interval-overlaps($itv7, $itv8)
 let $blnOverlapped1 := interval-overlapped-by($itv8, $itv7)
-let $blnOverlaps2 := interval-overlaps($itv8, $itv7)
-let $blnOverlapped2 := interval-overlapped-by($itv7, $itv8)
+let $blnOverlaps2 := interval-overlaps($itv9, $itv8)
+let $blnOverlapped2 := interval-overlapped-by($itv8, $itv9)
 let $blnOverlap1 := overlap($itv9, $itv7)
 let $blnOverlap2 := overlap($itv9, $itv8)
 
@@ -42,10 +42,13 @@
 let $blnStartedBy1 := interval-started-by($itv1, $itv10)
 let $blnStartedBy2 := interval-started-by($itv10, $itv2)
 
-let $blnCovers1 := interval-covers($itv6, $itv4)
-let $blnCovers2 := interval-covers($itv6, $itv5)
-let $blnCoveredBy1 := interval-covered-by($itv4, $itv6)
-let $blnCoveredBy2 := interval-covered-by($itv5, $itv6)
+let $itv10 := interval-from-datetime("19000707T020202222", "2013-08-07T03:03:03.333")
+let $itv11 := interval-from-datetime("19990707T020202222", "2013-08-07T03:03:03.333")
+let $itv12 := interval-from-datetime("-19990707T020202222", "2013-08-07T03:03:03.333")
+let $blnCovers1 := interval-covers($itv10, $itv11)
+let $blnCovers2 := interval-covers($itv10, $itv12)
+let $blnCoveredBy1 := interval-covered-by($itv11, $itv10)
+let $blnCoveredBy2 := interval-covered-by($itv12, $itv10)
 
 let $itv11 := interval-from-time("19:00:00.009", "20:29:20.000")
 let $blnEnds1 := interval-ends($itv11, $itv7)
diff --git a/asterix-app/src/test/resources/runtimets/queries/temp/time_functions.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions.aql
similarity index 74%
rename from asterix-app/src/test/resources/runtimets/queries/temp/time_functions.aql
rename to asterix-app/src/test/resources/runtimets/queries/temporal/time_functions.aql
index 29adcc0..c1d39fc 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temp/time_functions.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions.aql
@@ -8,7 +8,7 @@
 create dataverse test;
 use dataverse test;
 
-write output to nc1:"rttest/temp_time_functions.adm";
+write output to nc1:"rttest/temporal_time_functions.adm";
 
 let $t1 := time-from-unix-time-in-ms(1560074)
 let $dt1 := datetime("1327-12-02T23:35:49.938Z")
@@ -17,12 +17,14 @@
 let $t3 := time-from-datetime($dt2)
 let $dr1 := duration("-PT30H")
 let $t4 := add-time-duration($t1, $dr1)
+let $c1 := $t1 = add-time-duration($t4, subtract-time($t1, $t4))
 let $dr2 := duration("PT36M")
 let $t5 := add-time-duration($t2, $dr2)
+let $c2 := $t2 = add-time-duration($t5, subtract-time($t2, $t5))
 let $dr3 := subtract-time($t5, $t2)
 let $dr4 := subtract-time($t4, $t1)
 let $ct := current-time()
 let $cd := current-date()
 let $cdt := current-datetime()
 
-return { "time1" : $t1, "time2" : $t2, "time3" : $t3, "time4" : $t4, "time5" : $t5, "duration1" : $dr3, "duration2" : $dr4  }
\ No newline at end of file
+return { "time1" : $t1, "time2" : $t2, "time3" : $t3, "time4" : $t4, "time5" : $t5, "duration1" : $dr3, "duration2" : $dr4, "c1" : $c1, "c2" : $c2  }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/date_01.adm b/asterix-app/src/test/resources/runtimets/results/constructor/date_01.adm
index 2a90c4d..8a08a03 100644
--- a/asterix-app/src/test/resources/runtimets/results/constructor/date_01.adm
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/date_01.adm
@@ -1 +1 @@
-{ "date1": date("2010-10-30"), "date2": date("1987-11-19"), "date3": date("-1987-11-19"), "date4": date("0001-12-27"), "date5": date("-1951-12-27"), "date6": date("-2043-11-19"), "date7": date("-1928-03-29"), "date8": date("1928-03-29") }
\ No newline at end of file
+{ "date1": date("2010-10-30"), "date2": date("1987-11-19"), "date3": date("-1987-11-19"), "date4": date("0001-12-27"), "date5": date("-1951-12-27"), "date6": date("-2043-11-19"), "date7": date("-1928-03-29"), "date8": date("1928-03-29"), "date9": date("1900-02-28"), "date10": date("2000-02-29") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/interval.adm b/asterix-app/src/test/resources/runtimets/results/constructor/interval.adm
index 8fb7e25..893c3ff 100644
--- a/asterix-app/src/test/resources/runtimets/results/constructor/interval.adm
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/interval.adm
@@ -1 +1 @@
-{ "interval1": interval("date("2010-10-30"), date("2012-10-21")"), "interval2": interval("time("03:04:05.678Z"), time("23:24:25.267Z")"), "interval3": interval("datetime("-1987-11-19T02:43:57.938Z"), datetime("1999-11-12T12:49:35.948Z")"), "interval4": interval("date("0001-12-27"), date("0006-01-27")"), "interval5": interval("time("20:03:20.948Z"), time("20:57:50.886Z")"), "interval6": interval("datetime("-2043-11-19T15:32:39.293Z"), datetime("-1603-03-12T12:12:38.242Z")") }
\ No newline at end of file
+{ "interval1": interval-date("2010-10-30, 2012-10-21"), "interval2": interval-time("14:04:05.678Z, 21:24:25.267Z"), "interval3": interval-datetime("-1987-11-18T18:43:57.938Z, 1999-11-12T19:49:35.948Z"), "interval4": interval-date("0001-12-27, 0006-01-27"), "interval5": interval-time("20:03:20.948Z, 20:57:50.886Z"), "interval6": interval-datetime("-2043-11-19T15:32:39.293Z, -1603-03-12T12:12:38.242Z") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/time_01.adm b/asterix-app/src/test/resources/runtimets/results/constructor/time_01.adm
index ef6adc9..34a119f 100644
--- a/asterix-app/src/test/resources/runtimets/results/constructor/time_01.adm
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/time_01.adm
@@ -1 +1 @@
-{ "time1": time("05:50:56.200Z"), "time2": time("21:05:56.200Z"), "time3": time("10:50:56.000Z"), "time4": time("10:50:56.200Z"), "time5": time("13:29:59.999Z"), "time6": time("09:15:00.000Z"), "time7": time("13:59:00.019Z"), "time8": time("13:59:00.010Z"), "time9": time("13:59:00.019Z"), "time10": time("13:59:00.010Z"), "time11": time("13:59:00.019Z") }
+{ "time1": time("05:50:56.200Z"), "time2": time("21:05:56.200Z"), "time3": time("10:50:56.000Z"), "time4": time("10:50:56.200Z"), "time5": time("13:29:59.999Z"), "time6": time("09:15:00.000Z"), "time7": time("13:59:00.019Z"), "time8": time("13:59:00.010Z"), "time9": time("13:59:00.019Z"), "time10": time("13:59:00.010Z"), "time11": time("11:59:00.019Z") }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/abs3.adm b/asterix-app/src/test/resources/runtimets/results/numeric/abs3.adm
index 4da3272..9cf05af 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/abs3.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/abs3.adm
@@ -1 +1 @@
-{ "d0": 20.1d, "d1": 2.056E-29d, "d2": NaNd, "d3": Infinityd, "d4": Infinityd, "d5": 0.0d, "d6": 0.0d }
+{ "d0": 20.1d, "d1": 2.056E-29d, "d2": NaNd, "d3": Infinityd, "d4": Infinityd, "d5": 0.0d, "d6": 0.0d, "d7": 6.223372036854775808E18d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/abs4.adm b/asterix-app/src/test/resources/runtimets/results/numeric/abs4.adm
index f365181..01eec81 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/abs4.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/abs4.adm
@@ -1 +1 @@
-{ "f0": 20i8, "f1": 1.11d, "f2": 12.9d, "f3": 1.11d }
+{ "f0": 20i8, "f1": 1.11d, "f2": 12.9d, "f3": 1.11d, "f4": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3.adm b/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3.adm
index bf497d4..a188100 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/ceiling3.adm
@@ -1 +1 @@
-{ "d0": 21.0d, "d1": -0.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d }
+{ "d0": 21.0d, "d1": -0.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d, "d7": -6.223372036854775808E18d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/ceiling4.adm b/asterix-app/src/test/resources/runtimets/results/numeric/ceiling4.adm
index dcc17c0..35c0079 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/ceiling4.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/ceiling4.adm
@@ -1 +1 @@
-{ "f0": -20i8, "f1": -1.0d, "f2": 13.0d, "f3": 2.0d }
+{ "f0": -20i8, "f1": -1.0d, "f2": 13.0d, "f3": 2.0d, "f4": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/floor3.adm b/asterix-app/src/test/resources/runtimets/results/numeric/floor3.adm
index 58bdd79..34fb2f4 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/floor3.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/floor3.adm
@@ -1 +1 @@
-{ "d0": 20.0d, "d1": -1.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d }
+{ "d0": 20.0d, "d1": -1.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d, "d7": -6.223372036854775808E18d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/floor4.adm b/asterix-app/src/test/resources/runtimets/results/numeric/floor4.adm
index 3e972b3..43cd8ae 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/floor4.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/floor4.adm
@@ -1 +1 @@
-{ "f0": -20i8, "f1": -2.0d, "f2": 12.0d, "f3": 1.0d }
+{ "f0": -20i8, "f1": -2.0d, "f2": 12.0d, "f3": 1.0d, "f4": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23.adm
index 914a79e..00ca33d 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even23.adm
@@ -1 +1 @@
-{ "d0": 0.56d, "d1": 0.32d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d }
+{ "d0": 0.56d, "d1": 0.32d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d, "d7": -6223372036854775807.89d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even24.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even24.adm
index 956f0ac..01c28f3 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even24.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even24.adm
@@ -1 +1 @@
-{ "d0": 0.02d, "d1": 0.02d, "d2": 3567.81d, "d3": 0.0d, "d4": 35600.0d }
+{ "d0": 0.02d, "d1": 0.02d, "d2": 3567.81d, "d3": 0.0d, "d4": 35600.0d, "d5": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3.adm
index 60b7c52..2502aef 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even3.adm
@@ -1 +1 @@
-{ "d0": 0.0d, "d1": -20.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d }
+{ "d0": 0.0d, "d1": -20.0d, "d2": NaNd, "d3": Infinityd, "d4": -Infinityd, "d5": -0.0d, "d6": 0.0d, "d7": -6.223372036854775808E18d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even5.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even5.adm
index a53f62f..5507314 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even5.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round-half-to-even5.adm
@@ -1 +1 @@
-{ "f0": -20i8, "f1": -2.0d, "f2": 12.0d, "f3": 2.0d }
+{ "f0": -20i8, "f1": -2.0d, "f2": 12.0d, "f3": 2.0d, "f4": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round3.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round3.adm
index 1b1936d..9281799 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round3.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round3.adm
@@ -1 +1 @@
-{ "d0": 20.0d, "d1": 0.0d, "d2": 0.0d, "d3": 9.223372036854776E18d, "d4": -9.223372036854776E18d, "d5": 0.0d, "d6": 0.0d }
+{ "d0": 20.0d, "d1": 0.0d, "d2": 0.0d, "d3": 9.223372036854776E18d, "d4": -9.223372036854776E18d, "d5": 0.0d, "d6": 0.0d, "d7": -6.223372036854775808E18d }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/round4.adm b/asterix-app/src/test/resources/runtimets/results/numeric/round4.adm
index ce70363..64fc940 100644
--- a/asterix-app/src/test/resources/runtimets/results/numeric/round4.adm
+++ b/asterix-app/src/test/resources/runtimets/results/numeric/round4.adm
@@ -1 +1 @@
-{ "f0": -20i8, "f1": -1.0d, "f2": 13.0d, "f3": 1.0d }
+{ "f0": -20i8, "f1": -1.0d, "f2": 13.0d, "f3": 1.0d, "f4": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/string/matches11.adm b/asterix-app/src/test/resources/runtimets/results/string/matches11.adm
index 440a996..65ffc69 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/matches11.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/matches11.adm
@@ -3,3 +3,5 @@
 false
 false
 false
+true
+false
diff --git a/asterix-app/src/test/resources/runtimets/results/string/replace1.adm b/asterix-app/src/test/resources/runtimets/results/string/replace1.adm
index 5f992ce..24d401c 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/replace1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/replace1.adm
@@ -1 +1 @@
-{ "result1": "brcdbr", "result2": "abbraccaddabbra", "result3": "carted" }
+{ "result1": "brcdbr", "result2": "abbraccaddabbra", "result3": "carted", "result4": "-h-e-l-l-o-", "result5": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/string/string-equal-true1.adm b/asterix-app/src/test/resources/runtimets/results/string/string-equal-true1.adm
deleted file mode 100644
index ea9ca72..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/string-equal-true1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "result1": false }
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/calendar_duration.adm b/asterix-app/src/test/resources/runtimets/results/temp/calendar_duration.adm
deleted file mode 100644
index eb7d565..0000000
--- a/asterix-app/src/test/resources/runtimets/results/temp/calendar_duration.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "cduration1": duration("P20Y3M13DT7H48M21.329S"), "cduration2": duration("-P9M6DT4H45M39.328S"), "cduration3": duration("P8Y6M"), "cduration4": duration("-P21Y7M10DT13H9M42.983S"), "cduration5": duration("P20Y3M12DT7H48M21.329S"), "cduration6": duration("-P9M5DT4H45M39.328S"), "cduration7": duration("P8Y6M"), "cduration8": duration("-P21Y7M10DT13H9M42.983S") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/insert_from_ext_ds.adm b/asterix-app/src/test/resources/runtimets/results/temp/insert_from_ext_ds.adm
deleted file mode 100644
index afe2ccc..0000000
--- a/asterix-app/src/test/resources/runtimets/results/temp/insert_from_ext_ds.adm
+++ /dev/null
@@ -1,3 +0,0 @@
-{ "date": date("-2012-12-12"), "time": time("23:49:12.390Z"), "datetime": datetime("2012-12-12T00:00:00.001Z"), "duration": duration("P20Y19DT4H14M23.34S"), "interval": interval("datetime("2012-12-12T00:00:00.001Z"), datetime("2013-08-10T22:10:15.398Z")") }
-{ "date": null, "time": null, "datetime": datetime("1920-12-20T23:29:18.478Z"), "duration": null, "interval": null }
-{ "date": null, "time": null, "datetime": null, "duration": null, "interval": null }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/accessors.adm b/asterix-app/src/test/resources/runtimets/results/temporal/accessors.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/temp/accessors.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/accessors.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/adjust_timezone.adm b/asterix-app/src/test/resources/runtimets/results/temporal/adjust_timezone.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/temp/adjust_timezone.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/adjust_timezone.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/calendar_duration.adm b/asterix-app/src/test/resources/runtimets/results/temporal/calendar_duration.adm
new file mode 100644
index 0000000..957388f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/calendar_duration.adm
@@ -0,0 +1 @@
+{ "cduration1": duration("P20Y3M12DT7H48M21.329S"), "c1": true, "cduration2": duration("-P9M6DT4H45M39.328S"), "c2": true, "cduration3": duration("P8Y6M"), "c3": true, "cduration4": duration("-P21Y7M10DT13H9M42.983S"), "c4": true, "cduration5": duration("P20Y3M12DT7H48M21.329S"), "c5": true, "cduration6": duration("-P9M5DT4H45M39.328S"), "c6": true, "cduration7": duration("P8Y6M"), "c7": true, "cduration8": duration("-P21Y7M10DT13H9M42.983S"), "c8": true }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/date_functions.adm b/asterix-app/src/test/resources/runtimets/results/temporal/date_functions.adm
similarity index 80%
rename from asterix-app/src/test/resources/runtimets/results/temp/date_functions.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/date_functions.adm
index 2276f85..a5285d8 100644
--- a/asterix-app/src/test/resources/runtimets/results/temp/date_functions.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/date_functions.adm
@@ -1 +1 @@
-{ "date1": date("2012-09-17"), "date2": date("1327-12-02"), "date3": date("2012-10-10"), "date4": date("2010-05-17"), "date5": date("1703-08-09"), "duration1": duration("P137216D"), "duration2": duration("-P854D") }
\ No newline at end of file
+{ "date1": date("2012-09-17"), "date2": date("1327-12-02"), "date3": date("2012-10-10"), "date4": date("2010-05-17"), "date5": date("1703-08-09"), "duration1": duration("P137216D"), "duration2": duration("-P854D"), "c1": true, "c2": true }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/datetime_functions.adm b/asterix-app/src/test/resources/runtimets/results/temporal/datetime_functions.adm
similarity index 88%
rename from asterix-app/src/test/resources/runtimets/results/temp/datetime_functions.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/datetime_functions.adm
index 6ebc562..01f3758 100644
--- a/asterix-app/src/test/resources/runtimets/results/temp/datetime_functions.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/datetime_functions.adm
@@ -1 +1 @@
-{ "datetime1": datetime("1970-01-12T01:33:27.429Z"), "datetime2": datetime("1327-12-02T23:35:49.938Z"), "datetime3": datetime("1327-12-02T23:35:49.938Z"), "duration1": duration("-P234526DT1H57M37.491S") }
\ No newline at end of file
+{ "datetime1": datetime("1970-01-12T01:33:27.429Z"), "datetime2": datetime("1327-12-02T23:35:49.938Z"), "datetime3": datetime("1327-12-02T23:35:49.938Z"), "duration1": duration("-P234526DT1H57M37.491S"), "c1": true }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/insert_from_delimited_ds.adm b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_delimited_ds.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/temp/insert_from_delimited_ds.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/insert_from_delimited_ds.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds.adm b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds.adm
new file mode 100644
index 0000000..b087496
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds.adm
@@ -0,0 +1,3 @@
+{ "date": date("-2012-12-12"), "time": time("23:49:12.390Z"), "datetime": datetime("2012-12-12T00:00:00.001Z"), "duration": duration("P20Y19DT4H14M23.34S"), "interval": interval-datetime("2012-12-12T00:00:00.001Z, 2013-08-10T22:10:15.398Z") }
+{ "date": null, "time": time("04:12:12.219Z"), "datetime": datetime("1920-12-21T11:29:18.478Z"), "duration": null, "interval": interval-time("04:29:30.000Z, 07:59:59.999Z") }
+{ "date": null, "time": null, "datetime": datetime("-0290-03-22T17:59:48.999Z"), "duration": duration("-P27Y148D"), "interval": interval-date("-2012-03-17, 2013-04-01") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/interval_functions.adm b/asterix-app/src/test/resources/runtimets/results/temporal/interval_functions.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/temp/interval_functions.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/interval_functions.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/temp/time_functions.adm b/asterix-app/src/test/resources/runtimets/results/temporal/time_functions.adm
similarity index 75%
rename from asterix-app/src/test/resources/runtimets/results/temp/time_functions.adm
rename to asterix-app/src/test/resources/runtimets/results/temporal/time_functions.adm
index 56531bd..791d652 100644
--- a/asterix-app/src/test/resources/runtimets/results/temp/time_functions.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/time_functions.adm
@@ -1 +1 @@
-{ "time1": time("00:26:00.074Z"), "time2": time("23:35:49.938Z"), "time3": time("23:30:23.000Z"), "time4": time("18:26:00.074Z"), "time5": time("00:11:49.938Z"), "duration1": duration("-PT23H24M"), "duration2": duration("PT18H") }
\ No newline at end of file
+{ "time1": time("00:26:00.074Z"), "time2": time("23:35:49.938Z"), "time3": time("23:30:23.000Z"), "time4": time("18:26:00.074Z"), "time5": time("00:11:49.938Z"), "duration1": duration("-PT23H24M"), "duration2": duration("PT18H"), "c1": true, "c2": true }
\ 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 5a39f95..02eb1ee 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -3966,4 +3966,76 @@
       </compilation-unit>
     </test-case>
   </test-group>
-</test-suite>
+    <test-group name="temporal">
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="accessors">
+        <output-file compare="Text">accessors.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="adjust_timezone">
+        <output-file compare="Text">adjust_timezone.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="calendar_duration">
+        <output-file compare="Text">calendar_duration.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="date_functions">
+        <output-file compare="Text">date_functions.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="datetime_functions">
+        <output-file compare="Text">datetime_functions.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+<!--   	<test-case FilePath="temporal">
+  		<compilation-unit name="insert_from_delimited_ds">
+        <output-file compare="Text">insert_from_delimited_ds.adm</output-file>
+      </compilation-unit>
+  	</test-case> -->
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="insert_from_ext_ds">
+        <output-file compare="Text">insert_from_ext_ds.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="interval_functions">
+        <output-file compare="Text">interval_functions.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="temporal">
+  		<compilation-unit name="time_functions">
+        <output-file compare="Text">time_functions.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	<test-case FilePath="constructor">
+  		<compilation-unit name="date_01">
+        <output-file compare="Text">date_01.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	  	<test-case FilePath="constructor">
+  		<compilation-unit name="time_01">
+        <output-file compare="Text">time_01.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	  	<test-case FilePath="constructor">
+  		<compilation-unit name="datetime_01">
+        <output-file compare="Text">datetime_01.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	  	  	<test-case FilePath="constructor">
+  		<compilation-unit name="duration_01">
+        <output-file compare="Text">duration_01.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  	  	<test-case FilePath="constructor">
+  		<compilation-unit name="interval">
+        <output-file compare="Text">interval.adm</output-file>
+      </compilation-unit>
+  	</test-case>
+  </test-group>
+</test-suite>
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
index 918e286..327faf1 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
@@ -30,4 +30,14 @@
                 .append("-").append(String.format("%02d", gCalInstance.getDayOfMonthYear(chrononTime, year, month)));
         ps.print("\")");
     }
+
+    public void printString(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long chrononTime = AInt32SerializerDeserializer.getInt(b, s + 1) * CHRONON_OF_DAY;
+
+        int year = gCalInstance.getYear(chrononTime);
+        int month = gCalInstance.getMonthOfYear(chrononTime, year);
+
+        ps.append(String.format(year < 0 ? "%05d" : "%04d", year)).append("-").append(String.format("%02d", month))
+                .append("-").append(String.format("%02d", gCalInstance.getDayOfMonthYear(chrononTime, year, month)));
+    }
 }
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
index 96df767..7cf1478 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
@@ -33,4 +33,18 @@
                 .append(String.format("%03d", gCalInstance.getMillisOfSec(chrononTime))).append("Z");
         ps.print("\")");
     }
+
+    public void printString(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long chrononTime = AInt64SerializerDeserializer.getLong(b, s + 1);
+
+        int year = gCalInstance.getYear(chrononTime);
+        int month = gCalInstance.getMonthOfYear(chrononTime, year);
+
+        ps.append(String.format(year < 0 ? "%05d" : "%04d", year)).append("-").append(String.format("%02d", month))
+                .append("-").append(String.format("%02d", gCalInstance.getDayOfMonthYear(chrononTime, year, month)))
+                .append("T").append(String.format("%02d", gCalInstance.getHourOfDay(chrononTime))).append(":")
+                .append(String.format("%02d", gCalInstance.getMinOfHour(chrononTime))).append(":")
+                .append(String.format("%02d", gCalInstance.getSecOfMin(chrononTime))).append(".")
+                .append(String.format("%03d", gCalInstance.getMillisOfSec(chrononTime))).append("Z");
+    }
 }
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AIntervalPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AIntervalPrinter.java
index 99c40b2..b96feff 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AIntervalPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AIntervalPrinter.java
@@ -23,8 +23,6 @@
 
 public class AIntervalPrinter implements IPrinter {
 
-    private static final long serialVersionUID = 1L;
-
     public static final AIntervalPrinter INSTANCE = new AIntervalPrinter();
 
     /* (non-Javadoc)
@@ -39,32 +37,34 @@
      */
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        ps.print("interval(\"");
+        ps.print("interval");
 
         short typetag = AInt8SerializerDeserializer.getByte(b, s + 1 + 8 * 2);
 
         IPrinter timeInstancePrinter;
 
         if (typetag == ATypeTag.DATE.serialize()) {
+            ps.print("-date(\"");
             timeInstancePrinter = ADatePrinter.INSTANCE;
+            ((ADatePrinter)timeInstancePrinter).printString(b, s + 4, 4, ps);
+            ps.print(", ");
+            ((ADatePrinter)timeInstancePrinter).printString(b, s + 12, 4, ps);
         } else if (typetag == ATypeTag.TIME.serialize()) {
+            ps.print("-time(\"");
             timeInstancePrinter = ATimePrinter.INSTANCE;
+            ((ATimePrinter)timeInstancePrinter).printString(b, s + 4, 4, ps);
+            ps.print(", ");
+            ((ATimePrinter)timeInstancePrinter).printString(b, s + 12, 4, ps);
         } else if (typetag == ATypeTag.DATETIME.serialize()) {
+            ps.print("-datetime(\"");
             timeInstancePrinter = ADateTimePrinter.INSTANCE;
+            ((ADateTimePrinter)timeInstancePrinter).printString(b, s, 8, ps);
+            ps.print(", ");
+            ((ADateTimePrinter)timeInstancePrinter).printString(b, s + 8, 8, ps);
         } else {
             throw new AlgebricksException("Unsupport internal time types in interval: " + typetag);
         }
 
-        if (typetag == ATypeTag.TIME.serialize() || typetag == ATypeTag.DATE.serialize()) {
-            timeInstancePrinter.print(b, s + 1 + 4 - 1, 8, ps);
-            ps.print(", ");
-            timeInstancePrinter.print(b, s + 1 + 8 + 4 - 1, 8, ps);
-        } else {
-            timeInstancePrinter.print(b, s, 8, ps);
-            ps.print(", ");
-            timeInstancePrinter.print(b, s + 1 + 8 - 1, 8, ps);
-        }
-
         ps.print("\")");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
index b77ee64..aba6a4b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
@@ -29,5 +29,14 @@
 
         ps.print("\")");
     }
+    
+    public void printString(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int time = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+        ps.append(String.format("%02d", gCalInstance.getHourOfDay(time))).append(":")
+                .append(String.format("%02d", gCalInstance.getMinOfHour(time))).append(":")
+                .append(String.format("%02d", gCalInstance.getSecOfMin(time))).append(".")
+                .append(String.format("%03d", gCalInstance.getMillisOfSec(time))).append("Z");
+    }
 
 }
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
index 86a9a8d..5f68522 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateSerializerDeserializer.java
@@ -23,7 +23,6 @@
 import edu.uci.ics.asterix.om.base.AMutableDate;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
-import edu.uci.ics.asterix.om.base.temporal.StringCharSequenceAccessor;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -63,9 +62,7 @@
 
         long chrononTimeInMs = 0;
         try {
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
-            charAccessor.reset(date, 0, date.length());
-            chrononTimeInMs = ADateParserFactory.parseDatePart(charAccessor, true);
+            chrononTimeInMs = ADateParserFactory.parseDatePart(date, 0, date.length());
         } catch (Exception e) {
             throw new HyracksDataException(e);
         }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
index cedfc8d..34c3a5b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADateTimeSerializerDeserializer.java
@@ -23,7 +23,6 @@
 import edu.uci.ics.asterix.om.base.AMutableDateTime;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.StringCharSequenceAccessor;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -37,7 +36,7 @@
     @SuppressWarnings("unchecked")
     private static final ISerializerDeserializer<ADateTime> datetimeSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ADATETIME);
-
+    private static final AMutableDateTime aDateTime = new AMutableDateTime(0L);
     private static final String errorMessage = "This can not be an instance of datetime";
 
     private ADateTimeSerializerDeserializer() {
@@ -62,28 +61,25 @@
     }
 
     public static void parse(String datetime, DataOutput out) throws HyracksDataException {
-        AMutableDateTime aDateTime = new AMutableDateTime(0L);
 
         long chrononTimeInMs = 0;
         try {
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
-            charAccessor.reset(datetime, 0, datetime.length());
 
             // +1 if it is negative (-)
-            short timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
+            short timeOffset = (short) ((datetime.charAt(0) == '-') ? 1 : 0);
 
-            if (charAccessor.getCharAt(timeOffset + 10) != 'T' && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                throw new AlgebricksException(errorMessage + ": missing T");
+            timeOffset += 8;
+            
+            if(datetime.charAt(timeOffset) != 'T'){
+                timeOffset += 2;
+                if(datetime.charAt(timeOffset) != 'T'){
+                    throw new AlgebricksException(errorMessage + ": missing T");
+                }
             }
 
-            // if extended form 11, else 9
-            timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11) : (short) (9);
+            chrononTimeInMs = ADateParserFactory.parseDatePart(datetime, 0, timeOffset);
 
-            chrononTimeInMs = ADateParserFactory.parseDatePart(charAccessor, false);
-
-            charAccessor.reset(datetime, timeOffset, datetime.length() - timeOffset);
-
-            chrononTimeInMs += ATimeParserFactory.parseTimePart(charAccessor);
+            chrononTimeInMs += ATimeParserFactory.parseTimePart(datetime, timeOffset + 1, datetime.length() - timeOffset - 1);
         } catch (Exception e) {
             throw new HyracksDataException(e);
         }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
index 88e2ea5..6930f60 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
@@ -8,7 +8,6 @@
 import edu.uci.ics.asterix.om.base.ADuration;
 import edu.uci.ics.asterix.om.base.AMutableDuration;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.StringCharSequenceAccessor;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -21,6 +20,7 @@
     @SuppressWarnings("unchecked")
     private static final ISerializerDeserializer<ADuration> durationSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ADURATION);
+    private static final AMutableDuration aDuration = new AMutableDuration(0, 0);
 
     private ADurationSerializerDeserializer() {
     }
@@ -46,11 +46,7 @@
 
     public static void parse(String duration, DataOutput out) throws HyracksDataException {
         try {
-            AMutableDuration aDuration = new AMutableDuration(0, 0);
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
-            charAccessor.reset(duration, 0, duration.length());
-            ADurationParserFactory.parseDuration(charAccessor, aDuration);
-
+            ADurationParserFactory.parseDuration(duration, 0, duration.length(), aDuration);
             durationSerde.serialize(aDuration, out);
         } catch (Exception e) {
             throw new HyracksDataException(e);
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 7c87dfa..8c4def0 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
@@ -24,7 +24,6 @@
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
-import edu.uci.ics.asterix.om.base.temporal.StringCharSequenceAccessor;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -39,7 +38,7 @@
     @SuppressWarnings("unchecked")
     private static final ISerializerDeserializer<AInterval> intervalSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.AINTERVAL);
-
+    private static final AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
     private static final String errorMessage = "This can not be an instance of interval";
 
     private AIntervalSerializerDeserializer() {
@@ -64,7 +63,6 @@
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }
-
     }
 
     public static long getIntervalStart(byte[] data, int offset) {
@@ -87,68 +85,46 @@
      * @throws HyracksDataException
      */
     public static void parseDatetime(String interval, DataOutput out) throws HyracksDataException {
-        AMutableInterval aInterval = new AMutableInterval(0l, 0l, (byte) 0);
 
         long chrononTimeInMsStart = 0;
         long chrononTimeInMsEnd = 0;
         try {
 
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
+            // the starting point for parsing (so for the accessor)
+            int startOffset = 0;
+            int endOffset, timeSeperatorOffsetInDatetimeString;
 
             // Get the index for the comma
             int commaIndex = interval.indexOf(',');
-            if (commaIndex < 0) {
+            if (commaIndex < 1) {
                 throw new AlgebricksException("comma is missing for a string of interval");
             }
 
-            int nonSpaceIndex = commaIndex - 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex--;
+            endOffset = commaIndex - 1;
+
+            timeSeperatorOffsetInDatetimeString = interval.indexOf('T');
+
+            if (timeSeperatorOffsetInDatetimeString < 0) {
+                throw new AlgebricksException(errorMessage + ": missing T for a datetime value.");
             }
 
-            // Interval Start
-            charAccessor.reset(interval, 0, nonSpaceIndex + 1);
+            chrononTimeInMsStart = parseDatePart(interval, startOffset, timeSeperatorOffsetInDatetimeString - 1);
 
-            // +1 if it is negative (-)
-            short timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
-
-            if (charAccessor.getCharAt(timeOffset + 10) != 'T' && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                throw new AlgebricksException(errorMessage + ": missing T");
-            }
-
-            // if extended form 11, else 9
-            timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11) : (short) (9);
-
-            chrononTimeInMsStart = ADateParserFactory.parseDatePart(charAccessor, false);
-
-            charAccessor.reset(interval, timeOffset, nonSpaceIndex - timeOffset + 1);
-
-            chrononTimeInMsStart += ATimeParserFactory.parseTimePart(charAccessor);
+            chrononTimeInMsStart += parseTimePart(interval, timeSeperatorOffsetInDatetimeString + 1, endOffset);
 
             // Interval End
-            nonSpaceIndex = commaIndex + 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex++;
+            startOffset = commaIndex + 1;
+            endOffset = interval.length() - 1;
+
+            timeSeperatorOffsetInDatetimeString = interval.indexOf('T', startOffset);
+
+            if (timeSeperatorOffsetInDatetimeString < 0) {
+                throw new AlgebricksException(errorMessage + ": missing T for a datetime value.");
             }
 
-            charAccessor.reset(interval, nonSpaceIndex, interval.length() - nonSpaceIndex);
+            chrononTimeInMsEnd = parseDatePart(interval, startOffset, timeSeperatorOffsetInDatetimeString - 1);
 
-            // +1 if it is negative (-)
-            timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
-
-            if (charAccessor.getCharAt(timeOffset + 10) != 'T' && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                throw new AlgebricksException(errorMessage + ": missing T");
-            }
-
-            // if extended form 11, else 9
-            timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11) : (short) (9);
-
-            chrononTimeInMsEnd = ADateParserFactory.parseDatePart(charAccessor, false);
-
-            charAccessor.reset(interval, nonSpaceIndex + timeOffset, interval.length() - nonSpaceIndex - timeOffset);
-
-            chrononTimeInMsEnd += ATimeParserFactory.parseTimePart(charAccessor);
-
+            chrononTimeInMsEnd += parseTimePart(interval, timeSeperatorOffsetInDatetimeString + 1, endOffset);
         } catch (Exception e) {
             throw new HyracksDataException(e);
         }
@@ -159,13 +135,13 @@
     }
 
     public static void parseTime(String interval, DataOutput out) throws HyracksDataException {
-        AMutableInterval aInterval = new AMutableInterval(0l, 0l, (byte) 0);
 
         long chrononTimeInMsStart = 0;
         long chrononTimeInMsEnd = 0;
         try {
 
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
+            int startOffset = 0;
+            int endOffset;
 
             // Get the index for the comma
             int commaIndex = interval.indexOf(',');
@@ -173,27 +149,20 @@
                 throw new AlgebricksException("comma is missing for a string of interval");
             }
 
-            int nonSpaceIndex = commaIndex - 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex--;
-            }
+            endOffset = commaIndex - 1;
 
             // Interval Start
-            charAccessor.reset(interval, 0, nonSpaceIndex + 1);
-            chrononTimeInMsStart = ATimeParserFactory.parseTimePart(charAccessor);
+            chrononTimeInMsStart = parseTimePart(interval, startOffset, endOffset);
 
             if (chrononTimeInMsStart < 0) {
                 chrononTimeInMsStart += GregorianCalendarSystem.CHRONON_OF_DAY;
             }
 
             // Interval End
-            nonSpaceIndex = commaIndex + 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex++;
-            }
+            startOffset = commaIndex + 1;
+            endOffset = interval.length() - 1;
 
-            charAccessor.reset(interval, nonSpaceIndex, interval.length() - nonSpaceIndex);
-            chrononTimeInMsEnd = ATimeParserFactory.parseTimePart(charAccessor);
+            chrononTimeInMsEnd = parseTimePart(interval, startOffset, endOffset);
 
             if (chrononTimeInMsEnd < 0) {
                 chrononTimeInMsEnd += GregorianCalendarSystem.CHRONON_OF_DAY;
@@ -208,57 +177,67 @@
     }
 
     public static void parseDate(String interval, DataOutput out) throws HyracksDataException {
-        AMutableInterval aInterval = new AMutableInterval(0l, 0l, (byte) 0);
 
         long chrononTimeInMsStart = 0;
         long chrononTimeInMsEnd = 0;
-        short tempStart = 0;
-        short tempEnd = 0;
         try {
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
+
+            // the starting point for parsing (so for the accessor)
+            int startOffset = 0;
+            int endOffset;
 
             // Get the index for the comma
             int commaIndex = interval.indexOf(',');
-            if (commaIndex < 0) {
+            if (commaIndex < 1) {
                 throw new AlgebricksException("comma is missing for a string of interval");
             }
 
-            int nonSpaceIndex = commaIndex - 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex--;
-            }
+            endOffset = commaIndex - 1;
 
-            // Interval Start
-            charAccessor.reset(interval, 0, nonSpaceIndex + 1);
-
-            chrononTimeInMsStart = ADateParserFactory.parseDatePart(charAccessor, true);
-
-            if (chrononTimeInMsStart < 0 && chrononTimeInMsStart % GregorianCalendarSystem.CHRONON_OF_DAY != 0) {
-                tempStart = 1;
-            }
+            chrononTimeInMsStart = parseDatePart(interval, startOffset, endOffset);
 
             // Interval End
-            nonSpaceIndex = commaIndex + 1;
-            while (interval.charAt(nonSpaceIndex) == ' ') {
-                nonSpaceIndex++;
-            }
+            startOffset = commaIndex + 1;
+            endOffset = interval.length() - 1;
 
-            charAccessor.reset(interval, nonSpaceIndex, interval.length() - nonSpaceIndex);
-
-            chrononTimeInMsEnd = ADateParserFactory.parseDatePart(charAccessor, true);
-
-            if (chrononTimeInMsEnd < 0 && chrononTimeInMsEnd % GregorianCalendarSystem.CHRONON_OF_DAY != 0) {
-                tempEnd = 1;
-            }
+            chrononTimeInMsEnd = parseDatePart(interval, startOffset, endOffset);
 
         } catch (Exception e) {
             throw new HyracksDataException(e);
         }
 
-        aInterval.setValue((chrononTimeInMsStart / GregorianCalendarSystem.CHRONON_OF_DAY) - tempStart,
-                (chrononTimeInMsEnd / GregorianCalendarSystem.CHRONON_OF_DAY) - tempEnd, ATypeTag.DATE.serialize());
+        aInterval.setValue((chrononTimeInMsStart / GregorianCalendarSystem.CHRONON_OF_DAY),
+                (chrononTimeInMsEnd / GregorianCalendarSystem.CHRONON_OF_DAY), ATypeTag.DATE.serialize());
 
         intervalSerde.serialize(aInterval, out);
     }
 
+    private static long parseDatePart(String interval, int startOffset, int endOffset) throws AlgebricksException,
+            HyracksDataException {
+
+        while (interval.charAt(endOffset) == '"' || interval.charAt(endOffset) == ' ') {
+            endOffset--;
+        }
+
+        while (interval.charAt(startOffset) == '"' || interval.charAt(startOffset) == ' ') {
+            startOffset++;
+        }
+
+        return ADateParserFactory.parseDatePart(interval, startOffset, endOffset - startOffset + 1);
+    }
+
+    private static int parseTimePart(String interval, int startOffset, int endOffset) throws AlgebricksException,
+            HyracksDataException {
+
+        while (interval.charAt(endOffset) == '"' || interval.charAt(endOffset) == ' ') {
+            endOffset--;
+        }
+
+        while (interval.charAt(startOffset) == '"' || interval.charAt(startOffset) == ' ') {
+            startOffset++;
+        }
+
+        return ATimeParserFactory.parseTimePart(interval, startOffset, endOffset - startOffset + 1);
+    }
+
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
index 26e8d7a..8c3134a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ATimeSerializerDeserializer.java
@@ -8,7 +8,6 @@
 import edu.uci.ics.asterix.om.base.AMutableTime;
 import edu.uci.ics.asterix.om.base.ATime;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.StringCharSequenceAccessor;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -22,7 +21,8 @@
     @SuppressWarnings("unchecked")
     private static final ISerializerDeserializer<ATime> timeSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ATIME);
-
+    private static final AMutableTime aTime = new AMutableTime(0);
+    
     private ATimeSerializerDeserializer() {
     }
 
@@ -47,13 +47,10 @@
     }
 
     public static void parse(String time, DataOutput out) throws HyracksDataException {
-        AMutableTime aTime = new AMutableTime(0);
         int chrononTimeInMs;
 
         try {
-            StringCharSequenceAccessor charAccessor = new StringCharSequenceAccessor();
-            charAccessor.reset(time, 0, time.length());
-            chrononTimeInMs = ATimeParserFactory.parseTimePart(charAccessor);
+            chrononTimeInMs = ATimeParserFactory.parseTimePart(time, 0, time.length());
         } catch (Exception e) {
             throw new HyracksDataException(e);
         }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateParserFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateParserFactory.java
index 8192919..c1fbcb2 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateParserFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateParserFactory.java
@@ -36,15 +36,12 @@
     @Override
     public IValueParser createValueParser() {
 
-        final CharArrayCharSequenceAccessor charArrayAccessor = new CharArrayCharSequenceAccessor();
-
         return new IValueParser() {
 
             @Override
             public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
-                charArrayAccessor.reset(buffer, start, length);
                 try {
-                    out.writeInt((int) (parseDatePart(charArrayAccessor, true) / GregorianCalendarSystem.CHRONON_OF_DAY));
+                    out.writeInt((int) (parseDatePart(buffer, start, length) / GregorianCalendarSystem.CHRONON_OF_DAY));
                 } catch (IOException ex) {
                     throw new HyracksDataException(ex);
                 }
@@ -63,10 +60,9 @@
      * @return
      * @throws Exception
      */
-    public static <T> long parseDatePart(ICharSequenceAccessor<T> charAccessor, boolean isDateOnly)
+    public static long parseDatePart(String dateString, int start, int length)
             throws HyracksDataException {
 
-        int length = charAccessor.getLength();
         int offset = 0;
 
         int year = 0, month = 0, day = 0;
@@ -74,26 +70,25 @@
 
         boolean isExtendedForm = false;
 
-        if (charAccessor.getCharAt(offset) == '-') {
+        if (dateString.charAt(start + offset) == '-') {
             offset++;
             positive = false;
         }
 
-        if ((isDateOnly) && charAccessor.getCharAt(offset + 4) == '-' || (!isDateOnly)
-                && charAccessor.getCharAt(offset + 13) == ':') {
+        if (dateString.charAt(start + offset + 4) == '-') {
             isExtendedForm = true;
         }
 
         if (isExtendedForm) {
-            if (charAccessor.getCharAt(offset + 4) != '-' || charAccessor.getCharAt(offset + 7) != '-') {
+            if (dateString.charAt(start + offset + 4) != '-' || dateString.charAt(start + offset + 7) != '-') {
                 throw new HyracksDataException("Missing dash in the date string as an extended form");
             }
         }
 
         // year
         for (int i = 0; i < 4; i++) {
-            if (charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9') {
-                year = year * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if (dateString.charAt(start + offset + i) >= '0' && dateString.charAt(start + offset + i) <= '9') {
+                year = year * 10 + dateString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException("Non-numeric value in year field");
             }
@@ -108,8 +103,8 @@
 
         // month
         for (int i = 0; i < 2; i++) {
-            if ((charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9')) {
-                month = month * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if ((dateString.charAt(start + offset + i) >= '0' && dateString.charAt(start + offset + i) <= '9')) {
+                month = month * 10 + dateString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException("Non-numeric value in month field");
             }
@@ -123,8 +118,8 @@
 
         // day
         for (int i = 0; i < 2; i++) {
-            if ((charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9')) {
-                day = day * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if ((dateString.charAt(start + offset + i) >= '0' && dateString.charAt(start + offset + i) <= '9')) {
+                day = day * 10 + dateString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException("Non-numeric value in day field");
             }
@@ -141,10 +136,208 @@
             year *= -1;
         }
 
-        if (isDateOnly && length > offset) {
+        if (length > offset) {
             throw new HyracksDataException("Too many chars for a date only value");
         }
+        
+        if (!GregorianCalendarSystem.getInstance().validate(year, month, day, 0, 0, 0, 0)){
+            throw new HyracksDataException(dateErrorMessage);
+        }
+        
+        return GregorianCalendarSystem.getInstance().getChronon(year, month, day, 0, 0, 0, 0, 0);
+    }
+    
+    /**
+     * A copy-and-paste of {@link #parseDatePart(String, int, int)} but for a char array, in order
+     * to avoid object creation.
+     * 
+     * @param dateString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static long parseDatePart(char[] dateString, int start, int length)
+            throws HyracksDataException {
+
+        int offset = 0;
+
+        int year = 0, month = 0, day = 0;
+        boolean positive = true;
+
+        boolean isExtendedForm = false;
+
+        if (dateString[start + offset] == '-') {
+            offset++;
+            positive = false;
+        }
+
+        if (dateString[start + offset + 4] == '-') {
+            isExtendedForm = true;
+        }
+
+        if (isExtendedForm) {
+            if (dateString[start + offset + 4] != '-' || dateString[start + offset + 7] != '-') {
+                throw new HyracksDataException("Missing dash in the date string as an extended form");
+            }
+        }
+
+        // year
+        for (int i = 0; i < 4; i++) {
+            if (dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9') {
+                year = year * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in year field");
+            }
+        }
+
+        if (year < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.YEAR.ordinal()]
+                || year > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.YEAR.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": year " + year);
+        }
+
+        offset += (isExtendedForm) ? 5 : 4;
+
+        // month
+        for (int i = 0; i < 2; i++) {
+            if ((dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9')) {
+                month = month * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in month field");
+            }
+        }
+
+        if (month < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.MONTH.ordinal()]
+                || month > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.MONTH.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": month " + month);
+        }
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // day
+        for (int i = 0; i < 2; i++) {
+            if ((dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9')) {
+                day = day * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in day field");
+            }
+        }
+
+        if (day < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.DAY.ordinal()]
+                || day > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.DAY.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": day " + day);
+        }
+
+        offset += 2;
+
+        if (!positive) {
+            year *= -1;
+        }
+
+        if (length > offset) {
+            throw new HyracksDataException("Too many chars for a date only value");
+        }
+        
+        if (!GregorianCalendarSystem.getInstance().validate(year, month, day, 0, 0, 0, 0)){
+            throw new HyracksDataException(dateErrorMessage);
+        }
+        
         return GregorianCalendarSystem.getInstance().getChronon(year, month, day, 0, 0, 0, 0, 0);
     }
 
+    /**
+     * A copy-and-paste of {@link #parseDatePart(String, int, int)} but for a byte array, in order
+     * to avoid object creation.
+     * 
+     * @param dateString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static long parseDatePart(byte[] dateString, int start, int length)
+            throws HyracksDataException {
+
+        int offset = 0;
+
+        int year = 0, month = 0, day = 0;
+        boolean positive = true;
+
+        boolean isExtendedForm = false;
+
+        if (dateString[start + offset] == '-') {
+            offset++;
+            positive = false;
+        }
+
+        if (dateString[start + offset + 4] == '-') {
+            isExtendedForm = true;
+        }
+
+        if (isExtendedForm) {
+            if (dateString[start + offset + 4] != '-' || dateString[start + offset + 7] != '-') {
+                throw new HyracksDataException("Missing dash in the date string as an extended form");
+            }
+        }
+
+        // year
+        for (int i = 0; i < 4; i++) {
+            if (dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9') {
+                year = year * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in year field");
+            }
+        }
+
+        if (year < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.YEAR.ordinal()]
+                || year > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.YEAR.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": year " + year);
+        }
+
+        offset += (isExtendedForm) ? 5 : 4;
+
+        // month
+        for (int i = 0; i < 2; i++) {
+            if ((dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9')) {
+                month = month * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in month field");
+            }
+        }
+
+        if (month < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.MONTH.ordinal()]
+                || month > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.MONTH.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": month " + month);
+        }
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // day
+        for (int i = 0; i < 2; i++) {
+            if ((dateString[start + offset + i] >= '0' && dateString[start + offset + i] <= '9')) {
+                day = day * 10 + dateString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException("Non-numeric value in day field");
+            }
+        }
+
+        if (day < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.DAY.ordinal()]
+                || day > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.DAY.ordinal()]) {
+            throw new HyracksDataException(dateErrorMessage + ": day " + day);
+        }
+
+        offset += 2;
+
+        if (!positive) {
+            year *= -1;
+        }
+
+        if (length > offset) {
+            throw new HyracksDataException("Too many chars for a date only value");
+        }
+        
+        if (!GregorianCalendarSystem.getInstance().validate(year, month, day, 0, 0, 0, 0)){
+            throw new HyracksDataException(dateErrorMessage);
+        }
+        
+        return GregorianCalendarSystem.getInstance().getChronon(year, month, day, 0, 0, 0, 0, 0);
+    }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateTimeParserFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateTimeParserFactory.java
index 2df3c3b..c95ac3a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateTimeParserFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADateTimeParserFactory.java
@@ -36,31 +36,27 @@
     @Override
     public IValueParser createValueParser() {
 
-        final CharArrayCharSequenceAccessor charArrayAccessor = new CharArrayCharSequenceAccessor();
-
         return new IValueParser() {
 
             @Override
             public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
                 long chrononTimeInMs = 0;
 
-                charArrayAccessor.reset(buffer, start, length);
+                short timeOffset = (short) ((buffer[start] == '-') ? 1 : 0);
 
-                short timeOffset = (short) ((charArrayAccessor.getCharAt(0) == '-') ? 1 : 0);
+                timeOffset += 8;
 
-                if (charArrayAccessor.getCharAt(timeOffset + 10) != 'T'
-                        && charArrayAccessor.getCharAt(timeOffset + 8) != 'T') {
-                    throw new HyracksDataException(dateTimeErrorMessage + ": missing T");
+                if (buffer[start + timeOffset] != 'T') {
+                    timeOffset += 2;
+                    if (buffer[start + timeOffset] != 'T') {
+                        throw new HyracksDataException(dateTimeErrorMessage + ": missing T");
+                    }
                 }
 
-                // if extended form 11, else 9
-                timeOffset += (charArrayAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11) : (short) (9);
+                chrononTimeInMs = ADateParserFactory.parseDatePart(buffer, start, timeOffset);
 
-                chrononTimeInMs = ADateParserFactory.parseDatePart(charArrayAccessor, false);
-
-                charArrayAccessor.reset(buffer, start + timeOffset, length - timeOffset);
-
-                chrononTimeInMs += ATimeParserFactory.parseTimePart(charArrayAccessor);
+                chrononTimeInMs += ATimeParserFactory.parseTimePart(buffer, start + timeOffset + 1, length - timeOffset
+                        - 1);
 
                 try {
                     out.writeLong(chrononTimeInMs);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
index b176061..de5a6a1 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
@@ -36,14 +36,12 @@
 
     @Override
     public IValueParser createValueParser() {
-        final CharArrayCharSequenceAccessor charArrayAccessor = new CharArrayCharSequenceAccessor();
         final AMutableDuration aMutableDuration = new AMutableDuration(0, 0);
         return new IValueParser() {
 
             @Override
             public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
-                charArrayAccessor.reset(buffer, start, length);
-                parseDuration(charArrayAccessor, aMutableDuration);
+                parseDuration(buffer, start, length, aMutableDuration);
                 try {
                     out.writeInt(aMutableDuration.getMonths());
                     out.writeLong(aMutableDuration.getMilliseconds());
@@ -66,7 +64,7 @@
         SEC;
     };
 
-    public static <T> void parseDuration(ICharSequenceAccessor<T> charAccessor, AMutableDuration aDuration)
+    public static void parseDuration(String durationString, int start, int length, AMutableDuration aDuration)
             throws HyracksDataException {
 
         boolean positive = true;
@@ -74,21 +72,23 @@
         int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
         State state = State.NOTHING_READ;
 
-        if (charAccessor.getCharAt(offset) == '-') {
+        if (durationString.charAt(start + offset) == '-') {
             offset++;
             positive = false;
         }
 
-        if (charAccessor.getCharAt(offset++) != 'P') {
+        if (durationString.charAt(start + offset) != 'P') {
             throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
         }
 
-        for (; offset < charAccessor.getLength(); offset++) {
-            if (charAccessor.getCharAt(offset) >= '0' && charAccessor.getCharAt(offset) <= '9') {
+        offset++;
+
+        for (; offset < length; offset++) {
+            if (durationString.charAt(start + offset) >= '0' && durationString.charAt(start + offset) <= '9') {
                 // accumulate the digit fields
-                value = value * 10 + charAccessor.getCharAt(offset) - '0';
+                value = value * 10 + durationString.charAt(start + offset) - '0';
             } else {
-                switch (charAccessor.getCharAt(offset)) {
+                switch (durationString.charAt(start + offset)) {
                     case 'Y':
                         if (state.compareTo(State.YEAR) < 0) {
                             year = value;
@@ -139,11 +139,276 @@
                     case '.':
                         if (state.compareTo(State.MILLISEC) < 0) {
                             int i = 1;
-                            for (; offset + i < charAccessor.getLength(); i++) {
-                                if (charAccessor.getCharAt(offset + i) >= '0'
-                                        && charAccessor.getCharAt(offset + i) <= '9') {
+                            for (; offset + i < length; i++) {
+                                if (durationString.charAt(start + offset + i) >= '0'
+                                        && durationString.charAt(start + offset + i) <= '9') {
                                     if (i < 4) {
-                                        millisecond = millisecond * 10 + (charAccessor.getCharAt(offset + i) - '0');
+                                        millisecond = millisecond * 10
+                                                + (durationString.charAt(start + offset + i) - '0');
+                                    } else {
+                                        throw new HyracksDataException(durationErrorMessage
+                                                + ": wrong MILLISECOND field.");
+                                    }
+                                } else {
+                                    break;
+                                }
+                            }
+                            offset += i;
+                            state = State.MILLISEC;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong MILLISECOND field.");
+                        }
+                    case 'S':
+                        if (state.compareTo(State.SEC) < 0) {
+                            second = value;
+                            state = State.SEC;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong SECOND field.");
+                        }
+                        break;
+                    default:
+                        throw new HyracksDataException(durationErrorMessage + ": wrong format for duration.");
+
+                }
+                value = 0;
+            }
+        }
+
+        if (state.compareTo(State.TIME) == 0) {
+            throw new HyracksDataException(durationErrorMessage + ": no time fields after time separator.");
+        }
+
+        short temp = 1;
+        if (!positive) {
+            temp = -1;
+        }
+
+        aDuration.setValue(temp * (year * 12 + month), temp
+                * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
+
+    }
+
+    /**
+     * Copy-and-paste the code in {@link #parseDuration(String, int, int, AMutableDuration)} in order to eliminate
+     * object creation.
+     * 
+     * @param charAccessor
+     * @param start
+     * @param length
+     * @param aDuration
+     * @throws HyracksDataException
+     */
+    public static void parseDuration(char[] charAccessor, int start, int length, AMutableDuration aDuration)
+            throws HyracksDataException {
+
+        boolean positive = true;
+        int offset = 0;
+        int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
+        State state = State.NOTHING_READ;
+
+        if (charAccessor[start + offset] == '-') {
+            offset++;
+            positive = false;
+        }
+
+        if (charAccessor[start + offset] != 'P') {
+            throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
+        }
+
+        offset++;
+
+        for (; offset < length; offset++) {
+            if (charAccessor[start + offset] >= '0' && charAccessor[start + offset] <= '9') {
+                // accumulate the digit fields
+                value = value * 10 + charAccessor[start + offset] - '0';
+            } else {
+                switch (charAccessor[start + offset]) {
+                    case 'Y':
+                        if (state.compareTo(State.YEAR) < 0) {
+                            year = value;
+                            state = State.YEAR;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong YEAR feild.");
+                        }
+                        break;
+                    case 'M':
+                        if (state.compareTo(State.TIME) < 0) {
+                            if (state.compareTo(State.MONTH) < 0) {
+                                month = value;
+                                state = State.MONTH;
+                            } else {
+                                throw new HyracksDataException(durationErrorMessage + ": wrong MONTH field.");
+                            }
+                        } else if (state.compareTo(State.MIN) < 0) {
+                            minute = value;
+                            state = State.MIN;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong MIN field.");
+                        }
+                        break;
+                    case 'D':
+                        if (state.compareTo(State.DAY) < 0) {
+                            day = value;
+                            state = State.DAY;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong DAY field");
+                        }
+                        break;
+                    case 'T':
+                        if (state.compareTo(State.TIME) < 0) {
+                            state = State.TIME;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong TIME field.");
+                        }
+                        break;
+
+                    case 'H':
+                        if (state.compareTo(State.HOUR) < 0) {
+                            hour = value;
+                            state = State.HOUR;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong HOUR field.");
+                        }
+                        break;
+                    case '.':
+                        if (state.compareTo(State.MILLISEC) < 0) {
+                            int i = 1;
+                            for (; offset + i < length; i++) {
+                                if (charAccessor[start + offset + i] >= '0' && charAccessor[start + offset + i] <= '9') {
+                                    if (i < 4) {
+                                        millisecond = millisecond * 10 + (charAccessor[start + offset + i] - '0');
+                                    } else {
+                                        throw new HyracksDataException(durationErrorMessage
+                                                + ": wrong MILLISECOND field.");
+                                    }
+                                } else {
+                                    break;
+                                }
+                            }
+                            offset += i;
+                            state = State.MILLISEC;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong MILLISECOND field.");
+                        }
+                    case 'S':
+                        if (state.compareTo(State.SEC) < 0) {
+                            second = value;
+                            state = State.SEC;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong SECOND field.");
+                        }
+                        break;
+                    default:
+                        throw new HyracksDataException(durationErrorMessage + ": wrong format for duration.");
+
+                }
+                value = 0;
+            }
+        }
+
+        if (state.compareTo(State.TIME) == 0) {
+            throw new HyracksDataException(durationErrorMessage + ": no time fields after time separator.");
+        }
+
+        short temp = 1;
+        if (!positive) {
+            temp = -1;
+        }
+
+        aDuration.setValue(temp * (year * 12 + month), temp
+                * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
+
+    }
+
+    /**
+     * Copy-and-paste the code in {@link #parseDuration(String, int, int, AMutableDuration)} in order to eliminate
+     * object creation.
+     * 
+     * @param charAccessor
+     * @param start
+     * @param length
+     * @param aDuration
+     * @throws HyracksDataException
+     */
+    public static void parseDuration(byte[] charAccessor, int start, int length, AMutableDuration aDuration)
+            throws HyracksDataException {
+
+        boolean positive = true;
+        int offset = 0;
+        int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
+        State state = State.NOTHING_READ;
+
+        if (charAccessor[start + offset] == '-') {
+            offset++;
+            positive = false;
+        }
+
+        if (charAccessor[start + offset] != 'P') {
+            throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
+        }
+
+        offset++;
+
+        for (; offset < length; offset++) {
+            if (charAccessor[start + offset] >= '0' && charAccessor[start + offset] <= '9') {
+                // accumulate the digit fields
+                value = value * 10 + charAccessor[start + offset] - '0';
+            } else {
+                switch (charAccessor[start + offset]) {
+                    case 'Y':
+                        if (state.compareTo(State.YEAR) < 0) {
+                            year = value;
+                            state = State.YEAR;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong YEAR feild.");
+                        }
+                        break;
+                    case 'M':
+                        if (state.compareTo(State.TIME) < 0) {
+                            if (state.compareTo(State.MONTH) < 0) {
+                                month = value;
+                                state = State.MONTH;
+                            } else {
+                                throw new HyracksDataException(durationErrorMessage + ": wrong MONTH field.");
+                            }
+                        } else if (state.compareTo(State.MIN) < 0) {
+                            minute = value;
+                            state = State.MIN;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong MIN field.");
+                        }
+                        break;
+                    case 'D':
+                        if (state.compareTo(State.DAY) < 0) {
+                            day = value;
+                            state = State.DAY;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong DAY field");
+                        }
+                        break;
+                    case 'T':
+                        if (state.compareTo(State.TIME) < 0) {
+                            state = State.TIME;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong TIME field.");
+                        }
+                        break;
+
+                    case 'H':
+                        if (state.compareTo(State.HOUR) < 0) {
+                            hour = value;
+                            state = State.HOUR;
+                        } else {
+                            throw new HyracksDataException(durationErrorMessage + ": wrong HOUR field.");
+                        }
+                        break;
+                    case '.':
+                        if (state.compareTo(State.MILLISEC) < 0) {
+                            int i = 1;
+                            for (; offset + i < length; i++) {
+                                if (charAccessor[start + offset + i] >= '0' && charAccessor[start + offset + i] <= '9') {
+                                    if (i < 4) {
+                                        millisecond = millisecond * 10 + (charAccessor[start + offset + i] - '0');
                                     } else {
                                         throw new HyracksDataException(durationErrorMessage
                                                 + ": wrong MILLISECOND field.");
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ATimeParserFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ATimeParserFactory.java
index d76f41d..c0f0957 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ATimeParserFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ATimeParserFactory.java
@@ -36,15 +36,12 @@
     @Override
     public IValueParser createValueParser() {
 
-        final CharArrayCharSequenceAccessor charArrayAccessor = new CharArrayCharSequenceAccessor();
-
         return new IValueParser() {
 
             @Override
             public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
-                charArrayAccessor.reset(buffer, start, length);
                 try {
-                    out.writeInt(parseTimePart(charArrayAccessor));
+                    out.writeInt(parseTimePart(buffer, start, length));
                 } catch (IOException ex) {
                     throw new HyracksDataException(ex);
                 }
@@ -53,32 +50,34 @@
     }
 
     /**
-     * Parse the given char sequence as a time string, and return the milliseconds represented by the time.
+     * Parse the given string as a time string, and return the milliseconds represented by the time.
      * 
-     * @param charAccessor
+     * @param timeString
+     * @param start
+     * @param length
      * @return
-     * @throws Exception
+     * @throws HyracksDataException
      */
-    public static <T> int parseTimePart(ICharSequenceAccessor<T> charAccessor) throws HyracksDataException {
+    public static int parseTimePart(String timeString, int start, int length) throws HyracksDataException {
 
-        int length = charAccessor.getLength();
         int offset = 0;
 
         int hour = 0, min = 0, sec = 0, millis = 0;
         int timezone = 0;
 
         boolean isExtendedForm = false;
-        if (charAccessor.getCharAt(offset + 2) == ':') {
+        if (timeString.charAt(start + offset + 2) == ':') {
             isExtendedForm = true;
         }
 
-        if (isExtendedForm && (charAccessor.getCharAt(offset + 2) != ':' || charAccessor.getCharAt(offset + 5) != ':')) {
+        if (isExtendedForm
+                && (timeString.charAt(start + offset + 2) != ':' || timeString.charAt(start + offset + 5) != ':')) {
             throw new HyracksDataException(timeErrorMessage + ": Missing colon in an extended time format.");
         }
         // hour
         for (int i = 0; i < 2; i++) {
-            if ((charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9')) {
-                hour = hour * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if ((timeString.charAt(start + offset + i) >= '0' && timeString.charAt(start + offset + i) <= '9')) {
+                hour = hour * 10 + timeString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in hour field");
             }
@@ -93,8 +92,8 @@
 
         // minute
         for (int i = 0; i < 2; i++) {
-            if ((charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9')) {
-                min = min * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if ((timeString.charAt(start + offset + i) >= '0' && timeString.charAt(start + offset + i) <= '9')) {
+                min = min * 10 + timeString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in minute field");
             }
@@ -109,8 +108,8 @@
 
         // second
         for (int i = 0; i < 2; i++) {
-            if ((charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9')) {
-                sec = sec * 10 + charAccessor.getCharAt(offset + i) - '0';
+            if ((timeString.charAt(start + offset + i) >= '0' && timeString.charAt(start + offset + i) <= '9')) {
+                sec = sec * 10 + timeString.charAt(start + offset + i) - '0';
             } else {
                 throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in second field");
             }
@@ -123,14 +122,14 @@
 
         offset += 2;
 
-        if ((isExtendedForm && length > offset && charAccessor.getCharAt(offset) == '.')
+        if ((isExtendedForm && length > offset && timeString.charAt(start + offset) == '.')
                 || (!isExtendedForm && length > offset)) {
 
             offset += (isExtendedForm) ? 1 : 0;
             int i = 0;
             for (; i < 3 && offset + i < length; i++) {
-                if (charAccessor.getCharAt(offset + i) >= '0' && charAccessor.getCharAt(offset + i) <= '9') {
-                    millis = millis * 10 + charAccessor.getCharAt(offset + i) - '0';
+                if (timeString.charAt(start + offset + i) >= '0' && timeString.charAt(start + offset + i) <= '9') {
+                    millis = millis * 10 + timeString.charAt(start + offset + i) - '0';
                 } else {
                     break;
                 }
@@ -143,32 +142,31 @@
             }
 
             // error is thrown if more than three digits are seen for the millisecond part
-            if (charAccessor.getLength() > offset && charAccessor.getCharAt(offset) >= '0'
-                    && charAccessor.getCharAt(offset) <= '9') {
+            if (length > offset && timeString.charAt(start + offset) >= '0' && timeString.charAt(start + offset) <= '9') {
                 throw new HyracksDataException(timeErrorMessage + ": too many fields for millisecond.");
             }
         }
 
         if (length > offset) {
-            timezone = parseTimezonePart(charAccessor, offset);
+            timezone = parseTimezonePart(timeString, start + offset);
         }
 
         return GregorianCalendarSystem.getInstance().getChronon(hour, min, sec, millis, timezone);
     }
 
     /**
-     * Parse the given char sequence as a time string, and return the milliseconds represented by the time.
+     * Parse the given string as a time string, and parse the timezone field.
      * 
-     * @param charAccessor
+     * @param timeString
+     * @param start
      * @return
-     * @throws Exception
+     * @throws HyracksDataException
      */
-    public static <T> int parseTimezonePart(ICharSequenceAccessor<T> charAccessor, int offset)
-            throws HyracksDataException {
+    public static int parseTimezonePart(String timeString, int start) throws HyracksDataException {
         int timezone = 0;
 
-        if (charAccessor.getCharAt(offset) != 'Z') {
-            if ((charAccessor.getCharAt(offset) != '+' && charAccessor.getCharAt(offset) != '-')) {
+        if (timeString.charAt(start) != 'Z') {
+            if ((timeString.charAt(start) != '+' && timeString.charAt(start) != '-')) {
                 throw new HyracksDataException("Wrong timezone format: missing sign or missing colon for a time zone");
             }
 
@@ -176,8 +174,8 @@
             short timezoneMinute = 0;
 
             for (int i = 0; i < 2; i++) {
-                if ((charAccessor.getCharAt(offset + 1 + i) >= '0' && charAccessor.getCharAt(offset + 1 + i) <= '9')) {
-                    timezoneHour = (short) (timezoneHour * 10 + charAccessor.getCharAt(offset + 1 + i) - '0');
+                if ((timeString.charAt(start + 1 + i) >= '0' && timeString.charAt(start + 1 + i) <= '9')) {
+                    timezoneHour = (short) (timezoneHour * 10 + timeString.charAt(start + 1 + i) - '0');
                 } else {
                     throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone hour field");
                 }
@@ -188,13 +186,12 @@
                 throw new HyracksDataException(timeErrorMessage + ": time zone hour " + timezoneHour);
             }
 
-            int temp_offset = (charAccessor.getCharAt(offset + 3) == ':') ? 1 : 0;
+            int temp_offset = (timeString.charAt(start + 3) == ':') ? 1 : 0;
 
             for (int i = 0; i < 2; i++) {
-                if ((charAccessor.getCharAt(offset + temp_offset + 3 + i) >= '0' && charAccessor.getCharAt(offset
-                        + temp_offset + 3 + i) <= '9')) {
-                    timezoneMinute = (short) (timezoneMinute * 10
-                            + charAccessor.getCharAt(offset + temp_offset + 3 + i) - '0');
+                if ((timeString.charAt(start + temp_offset + 3 + i) >= '0' && timeString.charAt(start + temp_offset + 3
+                        + i) <= '9')) {
+                    timezoneMinute = (short) (timezoneMinute * 10 + timeString.charAt(start + temp_offset + 3 + i) - '0');
                 } else {
                     throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone minute field");
                 }
@@ -205,7 +202,333 @@
                 throw new HyracksDataException(timeErrorMessage + ": time zone minute " + timezoneMinute);
             }
 
-            if (charAccessor.getCharAt(offset) == '-') {
+            if (timeString.charAt(start) == '-') {
+                timezone = (byte) -((timezoneHour * 4) + timezoneMinute / 15);
+            } else {
+                timezone = (byte) ((timezoneHour * 4) + timezoneMinute / 15);
+            }
+        }
+        return timezone;
+    }
+
+    /**
+     * Similar to {@link #parseTimePart(String, int, int)} but use a char array as input; although this is almost
+     * a copy-and-past code but it avoids object creation.
+     * 
+     * @param timeString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static int parseTimePart(char[] timeString, int start, int length) throws HyracksDataException {
+
+        int offset = 0;
+
+        int hour = 0, min = 0, sec = 0, millis = 0;
+        int timezone = 0;
+
+        boolean isExtendedForm = false;
+        if (timeString[start + offset + 2] == ':') {
+            isExtendedForm = true;
+        }
+
+        if (isExtendedForm && (timeString[start + offset + 2] != ':' || timeString[start + offset + 5] != ':')) {
+            throw new HyracksDataException(timeErrorMessage + ": Missing colon in an extended time format.");
+        }
+        // hour
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                hour = hour * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in hour field");
+            }
+        }
+
+        if (hour < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.HOUR.ordinal()]
+                || hour > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.HOUR.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": hour " + hour);
+        }
+
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // minute
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                min = min * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in minute field");
+            }
+        }
+
+        if (min < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.MINUTE.ordinal()]
+                || min > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.MINUTE.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": min " + min);
+        }
+
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // second
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                sec = sec * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in second field");
+            }
+        }
+
+        if (sec < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.SECOND.ordinal()]
+                || sec > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.SECOND.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": sec " + sec);
+        }
+
+        offset += 2;
+
+        if ((isExtendedForm && length > offset && timeString[start + offset] == '.')
+                || (!isExtendedForm && length > offset)) {
+
+            offset += (isExtendedForm) ? 1 : 0;
+            int i = 0;
+            for (; i < 3 && offset + i < length; i++) {
+                if (timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9') {
+                    millis = millis * 10 + timeString[start + offset + i] - '0';
+                } else {
+                    break;
+                }
+            }
+
+            offset += i;
+
+            for (; i < 3; i++) {
+                millis = millis * 10;
+            }
+
+            // error is thrown if more than three digits are seen for the millisecond part
+            if (length > offset && timeString[start + offset] >= '0' && timeString[start + offset] <= '9') {
+                throw new HyracksDataException(timeErrorMessage + ": too many fields for millisecond.");
+            }
+        }
+
+        if (length > offset) {
+            timezone = parseTimezonePart(timeString, start + offset);
+        }
+
+        return GregorianCalendarSystem.getInstance().getChronon(hour, min, sec, millis, timezone);
+    }
+
+    /**
+     * Similar to {@link #parseTimezonePart(String, int)} but use a char array as input; although this is almost
+     * a copy-and-past code but it avoids object creation.
+     * 
+     * @param timeString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static int parseTimezonePart(char[] timeString, int start) throws HyracksDataException {
+        int timezone = 0;
+
+        if (timeString[start] != 'Z') {
+            if ((timeString[start] != '+' && timeString[start] != '-')) {
+                throw new HyracksDataException("Wrong timezone format: missing sign or missing colon for a time zone");
+            }
+
+            short timezoneHour = 0;
+            short timezoneMinute = 0;
+
+            for (int i = 0; i < 2; i++) {
+                if ((timeString[start + 1 + i] >= '0' && timeString[start + 1 + i] <= '9')) {
+                    timezoneHour = (short) (timezoneHour * 10 + timeString[start + 1 + i] - '0');
+                } else {
+                    throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone hour field");
+                }
+            }
+
+            if (timezoneHour < GregorianCalendarSystem.TIMEZONE_HOUR_MIN
+                    || timezoneHour > GregorianCalendarSystem.TIMEZONE_HOUR_MAX) {
+                throw new HyracksDataException(timeErrorMessage + ": time zone hour " + timezoneHour);
+            }
+
+            int temp_offset = (timeString[start + 3] == ':') ? 1 : 0;
+
+            for (int i = 0; i < 2; i++) {
+                if ((timeString[start + temp_offset + 3 + i] >= '0' && timeString[start + temp_offset + 3 + i] <= '9')) {
+                    timezoneMinute = (short) (timezoneMinute * 10 + timeString[start + temp_offset + 3 + i] - '0');
+                } else {
+                    throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone minute field");
+                }
+            }
+
+            if (timezoneMinute < GregorianCalendarSystem.TIMEZONE_MIN_MIN
+                    || timezoneMinute > GregorianCalendarSystem.TIMEZONE_MIN_MAX) {
+                throw new HyracksDataException(timeErrorMessage + ": time zone minute " + timezoneMinute);
+            }
+
+            if (timeString[start] == '-') {
+                timezone = (byte) -((timezoneHour * 4) + timezoneMinute / 15);
+            } else {
+                timezone = (byte) ((timezoneHour * 4) + timezoneMinute / 15);
+            }
+        }
+        return timezone;
+    }
+
+    /**
+     * Similar to {@link #parseTimePart(String, int, int)} but use a byte array as input; although this is almost
+     * a copy-and-past code but it avoids object creation.
+     * 
+     * @param timeString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static int parseTimePart(byte[] timeString, int start, int length) throws HyracksDataException {
+
+        int offset = 0;
+
+        int hour = 0, min = 0, sec = 0, millis = 0;
+        int timezone = 0;
+
+        boolean isExtendedForm = false;
+        if (timeString[start + offset + 2] == ':') {
+            isExtendedForm = true;
+        }
+
+        if (isExtendedForm && (timeString[start + offset + 2] != ':' || timeString[start + offset + 5] != ':')) {
+            throw new HyracksDataException(timeErrorMessage + ": Missing colon in an extended time format.");
+        }
+        // hour
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                hour = hour * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in hour field");
+            }
+        }
+
+        if (hour < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.HOUR.ordinal()]
+                || hour > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.HOUR.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": hour " + hour);
+        }
+
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // minute
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                min = min * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in minute field");
+            }
+        }
+
+        if (min < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.MINUTE.ordinal()]
+                || min > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.MINUTE.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": min " + min);
+        }
+
+        offset += (isExtendedForm) ? 3 : 2;
+
+        // second
+        for (int i = 0; i < 2; i++) {
+            if ((timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9')) {
+                sec = sec * 10 + timeString[start + offset + i] - '0';
+            } else {
+                throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in second field");
+            }
+        }
+
+        if (sec < GregorianCalendarSystem.FIELD_MINS[GregorianCalendarSystem.Fields.SECOND.ordinal()]
+                || sec > GregorianCalendarSystem.FIELD_MAXS[GregorianCalendarSystem.Fields.SECOND.ordinal()]) {
+            throw new HyracksDataException(timeErrorMessage + ": sec " + sec);
+        }
+
+        offset += 2;
+
+        if ((isExtendedForm && length > offset && timeString[start + offset] == '.')
+                || (!isExtendedForm && length > offset)) {
+
+            offset += (isExtendedForm) ? 1 : 0;
+            int i = 0;
+            for (; i < 3 && offset + i < length; i++) {
+                if (timeString[start + offset + i] >= '0' && timeString[start + offset + i] <= '9') {
+                    millis = millis * 10 + timeString[start + offset + i] - '0';
+                } else {
+                    break;
+                }
+            }
+
+            offset += i;
+
+            for (; i < 3; i++) {
+                millis = millis * 10;
+            }
+
+            // error is thrown if more than three digits are seen for the millisecond part
+            if (length > offset && timeString[start + offset] >= '0' && timeString[start + offset] <= '9') {
+                throw new HyracksDataException(timeErrorMessage + ": too many fields for millisecond.");
+            }
+        }
+
+        if (length > offset) {
+            timezone = parseTimezonePart(timeString, start + offset);
+        }
+
+        return GregorianCalendarSystem.getInstance().getChronon(hour, min, sec, millis, timezone);
+    }
+
+    /**
+     * Similar to {@link #parseTimezonePart(String, int)} but use a byte array as input; although this is almost
+     * a copy-and-past code but it avoids object creation.
+     * 
+     * @param timeString
+     * @param start
+     * @param length
+     * @return
+     * @throws HyracksDataException
+     */
+    public static int parseTimezonePart(byte[] timeString, int start) throws HyracksDataException {
+        int timezone = 0;
+
+        if (timeString[start] != 'Z') {
+            if ((timeString[start] != '+' && timeString[start] != '-')) {
+                throw new HyracksDataException("Wrong timezone format: missing sign or missing colon for a time zone");
+            }
+
+            short timezoneHour = 0;
+            short timezoneMinute = 0;
+
+            for (int i = 0; i < 2; i++) {
+                if ((timeString[start + 1 + i] >= '0' && timeString[start + 1 + i] <= '9')) {
+                    timezoneHour = (short) (timezoneHour * 10 + timeString[start + 1 + i] - '0');
+                } else {
+                    throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone hour field");
+                }
+            }
+
+            if (timezoneHour < GregorianCalendarSystem.TIMEZONE_HOUR_MIN
+                    || timezoneHour > GregorianCalendarSystem.TIMEZONE_HOUR_MAX) {
+                throw new HyracksDataException(timeErrorMessage + ": time zone hour " + timezoneHour);
+            }
+
+            int temp_offset = (timeString[start + 3] == ':') ? 1 : 0;
+
+            for (int i = 0; i < 2; i++) {
+                if ((timeString[start + temp_offset + 3 + i] >= '0' && timeString[start + temp_offset + 3 + i] <= '9')) {
+                    timezoneMinute = (short) (timezoneMinute * 10 + timeString[start + temp_offset + 3 + i] - '0');
+                } else {
+                    throw new HyracksDataException(timeErrorMessage + ": Non-numeric value in timezone minute field");
+                }
+            }
+
+            if (timezoneMinute < GregorianCalendarSystem.TIMEZONE_MIN_MIN
+                    || timezoneMinute > GregorianCalendarSystem.TIMEZONE_MIN_MAX) {
+                throw new HyracksDataException(timeErrorMessage + ": time zone minute " + timezoneMinute);
+            }
+
+            if (timeString[start] == '-') {
                 timezone = (byte) -((timezoneHour * 4) + timezoneMinute / 15);
             } else {
                 timezone = (byte) ((timezoneHour * 4) + timezoneMinute / 15);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ByteArrayCharSequenceAccessor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ByteArrayCharSequenceAccessor.java
deleted file mode 100644
index 453c86f..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ByteArrayCharSequenceAccessor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009-2011 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.asterix.om.base.temporal;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixRuntimeException;
-
-public class ByteArrayCharSequenceAccessor implements ICharSequenceAccessor<Byte[]> {
-
-    private byte[] buf;
-    private int offset;
-    private int length;
-
-    @Override
-    public char getCharAt(int index) throws AsterixRuntimeException {
-        if (index < 0 || index >= length) {
-            throw new AsterixRuntimeException("Byte array char accessor is out of bound: " + index + ":" + length);
-        }
-        return (char) (buf[index + offset]);
-    }
-
-    /**
-     * Reset the wrapped byte array.
-     * 
-     * @param obj
-     *            The byte array to be wrapped
-     * @param beginOffset
-     *            The offset of the string stored in the byte array.
-     * @param offset
-     *            The offset of the substring of the string stored (offset from the beginOffset).
-     */
-    public void reset(byte[] obj, int offset, int length) {
-        this.buf = obj;
-        this.offset = offset;
-        this.length = length;
-    }
-
-    @Override
-    public int getLength() {
-        return length;
-    }
-
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/CharArrayCharSequenceAccessor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/CharArrayCharSequenceAccessor.java
deleted file mode 100644
index 404f0ee..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/CharArrayCharSequenceAccessor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009-2011 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.asterix.om.base.temporal;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixRuntimeException;
-
-public class CharArrayCharSequenceAccessor implements ICharSequenceAccessor<char[]> {
-
-    private char[] buf;
-    private int offset;
-    private int length;
-    
-    @Override
-    public char getCharAt(int index) throws AsterixRuntimeException {
-        if (index < 0 || index >= length) {
-            throw new AsterixRuntimeException("Byte array char accessor is out of bound: " + index + ":" + length);
-        }
-        return (char) (buf[index + offset]);
-    }
-
-    /**
-     * Reset the wrapped byte array.
-     * 
-     * @param obj
-     *            The byte array to be wrapped
-     * @param beginOffset
-     *            The offset of the string stored in the byte array.
-     * @param offset
-     *            The offset of the substring of the string stored (offset from the beginOffset).
-     */
-    public void reset(char[] obj, int offset, int length) {
-        this.buf = obj;
-        this.offset = offset;
-        this.length = length;
-    }
-
-    @Override
-    public int getLength() {
-        return length;
- }
-
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/GregorianCalendarSystem.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/GregorianCalendarSystem.java
index d43f235..f74af9b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/GregorianCalendarSystem.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/GregorianCalendarSystem.java
@@ -135,11 +135,11 @@
         // Check whether leap month.
         if (month == 2) {
             if (isLeapYear(year)) {
-                if (month > DAYS_OF_MONTH_LEAP[1]) {
+                if (day > DAYS_OF_MONTH_LEAP[1]) {
                     return false;
                 }
             } else {
-                if (month > DAYS_OF_MONTH_ORDI[1]) {
+                if (day > DAYS_OF_MONTH_ORDI[1]) {
                     return false;
                 }
             }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ICharSequenceAccessor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ICharSequenceAccessor.java
deleted file mode 100644
index d5a99a0..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ICharSequenceAccessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2009-2011 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.asterix.om.base.temporal;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixRuntimeException;
-
-public interface ICharSequenceAccessor<T> {
-
-    /**
-     * Return the character in the wrapped char sequence at the given index.
-     * 
-     * @param index
-     * @return
-     */
-    public char getCharAt(int index) throws AsterixRuntimeException;
-
-    /**
-     * Get the length of the wrapped char sequence.
-     * 
-     * @return
-     */
-    public int getLength();
-
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/StringCharSequenceAccessor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/StringCharSequenceAccessor.java
deleted file mode 100644
index 17e483a..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/StringCharSequenceAccessor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2009-2011 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.asterix.om.base.temporal;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixRuntimeException;
-
-public class StringCharSequenceAccessor implements ICharSequenceAccessor<String> {
-
-    private String string;
-    private int offset;
-    private int length;
-
-    @Override
-    public char getCharAt(int index) throws AsterixRuntimeException {
-        if (index >= length) {
-            throw new AsterixRuntimeException("String accessor is out of bound.");
-        }
-        return string.charAt(index + offset);
-    }
-
-    public void reset(String obj, int offset, int len) {
-        this.string = obj;
-        this.offset = offset;
-        this.length = len;
-    }
-
-    @Override
-    public int getLength() {
-        return length;
-    }
-
-}
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 a547737..e8a9719 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
@@ -448,7 +448,7 @@
     public static final FunctionIdentifier ACCESSOR_TEMPORAL_YEAR = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "year", 1);
     public static final FunctionIdentifier ACCESSOR_TEMPORAL_MONTH = new FunctionIdentifier(
-            FunctionConstants.ASTERIX_NS, "month", 2);
+            FunctionConstants.ASTERIX_NS, "month", 1);
     public static final FunctionIdentifier ACCESSOR_TEMPORAL_DAY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "day", 1);
     public static final FunctionIdentifier ACCESSOR_TEMPORAL_HOUR = new FunctionIdentifier(
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
index 3664804..b78308d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
@@ -31,6 +31,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AInt32Printer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AInt64Printer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AInt8Printer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AIntervalPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ALinePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ANullPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.APoint3DPrinter;
@@ -173,6 +174,10 @@
                     AStringPrinter.INSTANCE.print(b, s, l, ps);
                     break;
                 }
+                case INTERVAL: {
+                    AIntervalPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
                 default: {
                     throw new NotImplementedException("No printer for type " + typeTag);
                 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
index e69fbcd..a0ad3e1 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
@@ -42,9 +42,9 @@
     LINE(30),
     POLYGON(31),
     CIRCLE(32),
-    INTERVAL(34),
     RECTANGLE(33),
-    SYSTEM_NULL(34);
+    INTERVAL(34),
+    SYSTEM_NULL(35);
 
     private byte value;
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index 2b4ea3a..1565cb9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -136,7 +136,7 @@
     private ComparisonResult compareDateOrTimeWithArg(ATypeTag typeTag2) throws AlgebricksException {
         if (typeTag2 == ATypeTag.NULL) {
             return ComparisonResult.GREATER_THAN;
-        } else if (typeTag2 == ATypeTag.DATETIME) {
+        } else if (typeTag2 == ATypeTag.DATE || typeTag2 == ATypeTag.TIME) {
             int result = dateOrTimeBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
                     outRight.getByteArray(), 1, outRight.getLength() - 1);
             if (result == 0)
@@ -146,7 +146,7 @@
             else
                 return ComparisonResult.GREATER_THAN;
         }
-        throw new AlgebricksException("Comparison is undefined between types ADateTime and " + typeTag2 + " .");
+        throw new AlgebricksException("Comparison is undefined between types Date/Time and " + typeTag2 + " .");
     }
 
     private ComparisonResult compareDateTimeWithArg(ATypeTag typeTag2) throws AlgebricksException {
@@ -162,7 +162,7 @@
             else
                 return ComparisonResult.GREATER_THAN;
         }
-        throw new AlgebricksException("Comparison is undefined between types ADateTime and " + typeTag2 + " .");
+        throw new AlgebricksException("Comparison is undefined between types Datetime and " + typeTag2 + " .");
     }
 
     private ComparisonResult compareBooleanWithArg(ATypeTag typeTag2) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
index 44fcf7c..a1f9911 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
@@ -22,7 +22,6 @@
 import edu.uci.ics.asterix.om.base.AMutableDate;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -73,8 +72,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -86,8 +83,17 @@
 
                                 int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
 
-                                charAccessor.reset(serString, 3, stringLength);
-                                long chrononTimeInMs = ADateParserFactory.parseDatePart(charAccessor, true);
+                                int startOffset = 3;
+                                while (serString[startOffset] == ' ') {
+                                    startOffset++;
+                                }
+                                int endOffset = stringLength - 1 + 3;
+                                while (serString[endOffset] == ' ') {
+                                    endOffset--;
+                                }
+
+                                long chrononTimeInMs = ADateParserFactory.parseDatePart(serString, startOffset,
+                                        endOffset - startOffset + 1);
 
                                 short temp = 0;
                                 if (chrononTimeInMs < 0
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
index 6a5783b..83f4c8b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
@@ -23,7 +23,6 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -72,7 +71,6 @@
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -85,25 +83,22 @@
 
                                 int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
 
-                                charAccessor.reset(serString, 3, stringLength);
-
                                 // +1 if it is negative (-)
-                                short timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
+                                short timeOffset = (short) ((serString[3] == '-') ? 1 : 0);
 
-                                if (charAccessor.getCharAt(timeOffset + 10) != 'T'
-                                        && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                                    throw new AlgebricksException(errorMessage + ": missing T");
+                                timeOffset += 8;
+
+                                if (serString[3 + timeOffset] != 'T') {
+                                    timeOffset += 2;
+                                    if (serString[3 + timeOffset] != 'T') {
+                                        throw new AlgebricksException(errorMessage + ": missing T");
+                                    }
                                 }
 
-                                // if extended form 11, else 9
-                                timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11)
-                                        : (short) (9);
+                                long chrononTimeInMs = ADateParserFactory.parseDatePart(serString, 3, timeOffset);
 
-                                long chrononTimeInMs = ADateParserFactory.parseDatePart(charAccessor, false);
-
-                                charAccessor.reset(serString, 3 + timeOffset, stringLength - timeOffset);
-
-                                chrononTimeInMs += ATimeParserFactory.parseTimePart(charAccessor);
+                                chrononTimeInMs += ATimeParserFactory.parseTimePart(serString, 3 + timeOffset + 1,
+                                        stringLength - timeOffset - 1);
 
                                 aDateTime.setValue(chrononTimeInMs);
                                 datetimeSerde.serialize(aDateTime, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index b2b3f4e..a84ae1d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -21,7 +21,6 @@
 import edu.uci.ics.asterix.om.base.AMutableDuration;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -43,8 +42,6 @@
     private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
 
-    private final static ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
         public IFunctionDescriptor createFunctionDescriptor() {
             return new ADurationConstructorDescriptor();
@@ -85,9 +82,7 @@
 
                                 int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
 
-                                charAccessor.reset(serString, 3, stringLength);
-
-                                ADurationParserFactory.parseDuration(charAccessor, aDuration);
+                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDuration);
 
                                 durationSerde.serialize(aDuration, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
index e1a12f8..0414874 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
@@ -23,7 +23,6 @@
 import edu.uci.ics.asterix.om.base.AMutableInterval;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -78,8 +77,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -100,17 +97,15 @@
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
                                 // start date
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
-                                long intervalStart = ADateParserFactory.parseDatePart(charAccessor, true)
-                                        / GregorianCalendarSystem.CHRONON_OF_DAY;
-                                // end date
+                                long intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
+                                        stringLength) / GregorianCalendarSystem.CHRONON_OF_DAY;
 
+                                // end date
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-                                long intervalEnd = ADateParserFactory.parseDatePart(charAccessor, true)
-                                        / GregorianCalendarSystem.CHRONON_OF_DAY;
+                                long intervalEnd = ADateParserFactory.parseDatePart(argOut1.getByteArray(), 3,
+                                        stringLength) / GregorianCalendarSystem.CHRONON_OF_DAY;
 
                                 if (intervalEnd < intervalStart) {
                                     throw new AlgebricksException(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
index 72a8e37..6b3e2b6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
@@ -24,7 +24,6 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -78,8 +77,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -95,47 +92,43 @@
                                 nullSerde.serialize(ANull.NULL, out);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG
                                     && argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                // start date
-
+                                // start datetime
                                 int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
-
-                                if (charAccessor.getCharAt(timeOffset + 10) != 'T'
-                                        && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                                    throw new AlgebricksException(errorMessage + ": missing T");
+                                short timeOffset = (short) ((argOut0.getByteArray()[3] == '-') ? 1 : 0);
+                                timeOffset += 8;
+                                if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                    timeOffset += 2;
+                                    if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                        throw new AlgebricksException(errorMessage + ": missing T");
+                                    }
                                 }
 
-                                // if extended form 11, else 9
-                                timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11)
-                                        : (short) (9);
-                                long intervalStart = ADateParserFactory.parseDatePart(charAccessor, false);
-                                charAccessor.reset(argOut0.getByteArray(), 3 + timeOffset, stringLength - timeOffset);
-                                intervalStart += ATimeParserFactory.parseTimePart(charAccessor);
+                                long intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
+                                        timeOffset);
+                                intervalStart += ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
+                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
 
-                                // end date
-
+                                // end datetime
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
                                 // get offset for time part: +1 if it is negative (-)
-                                timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
-
-                                if (charAccessor.getCharAt(timeOffset + 10) != 'T'
-                                        && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                                    throw new AlgebricksException(errorMessage + ": missing T");
+                                timeOffset = (short) ((argOut1.getByteArray()[3] == '-') ? 1 : 0);
+                                timeOffset += 8;
+                                if (argOut1.getByteArray()[3 + timeOffset] != 'T') {
+                                    timeOffset += 2;
+                                    if (argOut1.getByteArray()[3 + timeOffset] != 'T') {
+                                        throw new AlgebricksException(errorMessage + ": missing T");
+                                    }
                                 }
 
-                                // if extended form 11, else 9
-                                timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11)
-                                        : (short) (9);
-                                long intervalEnd = ADateParserFactory.parseDatePart(charAccessor, false);
-                                charAccessor.reset(argOut1.getByteArray(), 3 + timeOffset, stringLength - timeOffset);
-                                intervalEnd += ATimeParserFactory.parseTimePart(charAccessor);
+                                long intervalEnd = ADateParserFactory.parseDatePart(argOut1.getByteArray(), 3,
+                                        timeOffset);
+                                intervalEnd += ATimeParserFactory.parseTimePart(argOut1.getByteArray(),
+                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
 
                                 if (intervalEnd < intervalStart) {
                                     throw new AlgebricksException(
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
index 3ce722a..042a33b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
@@ -23,7 +23,6 @@
 import edu.uci.ics.asterix.om.base.AMutableInterval;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -78,8 +77,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -96,23 +93,21 @@
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG
                                     && argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // start date
-
                                 int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
-                                long intervalStart = ATimeParserFactory.parseTimePart(charAccessor);
+                                long intervalStart = ATimeParserFactory.parseTimePart(argOut0.getByteArray(), 3,
+                                        stringLength);
                                 if (intervalStart < 0) {
                                     intervalStart += GregorianCalendarSystem.CHRONON_OF_DAY;
                                 }
 
                                 // end date
-
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-                                long intervalEnd = ATimeParserFactory.parseTimePart(charAccessor);
+                                long intervalEnd = ATimeParserFactory.parseTimePart(argOut1.getByteArray(), 3,
+                                        stringLength);
                                 if (intervalEnd < 0) {
                                     intervalEnd += GregorianCalendarSystem.CHRONON_OF_DAY;
                                 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
index 23fdb07..d5a0db9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
@@ -25,7 +25,6 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -82,8 +81,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -99,20 +96,20 @@
                                 nullSerde.serialize(ANull.NULL, out);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG
                                     && argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                // start date
 
+                                // start date
                                 int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
-                                long intervalStart = ADateParserFactory.parseDatePart(charAccessor, true);
-                                // duration
+                                long intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
+                                        stringLength);
 
+                                // duration
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-                                ADurationParserFactory.parseDuration(charAccessor, aDuration);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
 
                                 long intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
index 91c45df..d821fc3 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
@@ -26,7 +26,6 @@
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -82,8 +81,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -104,29 +101,29 @@
                                 int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((charAccessor.getCharAt(0) == '-') ? 1 : 0);
+                                short timeOffset = (short) ((argOut0.getByteArray()[3] == '-') ? 1 : 0);
 
-                                if (charAccessor.getCharAt(timeOffset + 10) != 'T'
-                                        && charAccessor.getCharAt(timeOffset + 8) != 'T') {
-                                    throw new AlgebricksException(errorMessage + ": missing T");
+                                timeOffset += 8;
+
+                                if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                    timeOffset += 2;
+                                    if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                        throw new AlgebricksException(errorMessage + ": missing T");
+                                    }
                                 }
 
-                                // if extended form 11, else 9
-                                timeOffset += (charAccessor.getCharAt(timeOffset + 13) == ':') ? (short) (11)
-                                        : (short) (9);
-                                long intervalStart = ADateParserFactory.parseDatePart(charAccessor, false);
-                                charAccessor.reset(argOut0.getByteArray(), 3 + timeOffset, stringLength - timeOffset);
-                                intervalStart += ATimeParserFactory.parseTimePart(charAccessor);
+                                long intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
+                                        timeOffset);
+                                intervalStart += ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
+                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
 
                                 // duration
-
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-                                ADurationParserFactory.parseDuration(charAccessor, aDuration);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
 
                                 long intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
index e576fef..8135598 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
@@ -25,7 +25,6 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -82,8 +81,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -104,8 +101,8 @@
                                 int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
                                         + (argOut0.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut0.getByteArray(), 3, stringLength);
-                                int intervalStart = ATimeParserFactory.parseTimePart(charAccessor);
+                                int intervalStart = ATimeParserFactory.parseTimePart(argOut0.getByteArray(), 3,
+                                        stringLength);
 
                                 if (intervalStart < 0) {
                                     intervalStart += GregorianCalendarSystem.CHRONON_OF_DAY;
@@ -116,8 +113,8 @@
                                 stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-                                ADurationParserFactory.parseDuration(charAccessor, aDuration);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
 
                                 if (aDuration.getMonths() != 0) {
                                     throw new AlgebricksException("Cannot add a year-month duration to a time value.");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
index caff78b..f2ad400 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
@@ -22,7 +22,6 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.ATime;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -73,8 +72,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -86,8 +83,7 @@
 
                                 int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
 
-                                charAccessor.reset(serString, 3, stringLength);
-                                int chrononTimeInMs = ATimeParserFactory.parseTimePart(charAccessor);
+                                int chrononTimeInMs = ATimeParserFactory.parseTimePart(serString, 3, stringLength);
 
                                 if (chrononTimeInMs < 0) {
                                     chrononTimeInMs += GregorianCalendarSystem.CHRONON_OF_DAY;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
index 5dcb838..55fe563 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
@@ -93,9 +93,6 @@
                     private ICopyEvaluatorFactory listEvalFactory = args[0];
                     private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
                     private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -103,10 +100,6 @@
                             outInputList.reset();
                             evalList.evaluate(tuple);
                             byte[] serOrderedList = outInputList.getByteArray();
-                            if (serOrderedList[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
                             if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException("Expects an Integer List."
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
index 06cf69a..e205bf5 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
@@ -98,13 +98,10 @@
                             return (int) AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
                         } else if (argOut.getByteArray()[0] == serInt64TypeTag) {
                             return (int) AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
-                        } else if (argOut.getByteArray()[0] == serFloatTypeTag) {
-                            return (int) AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
-                        } else if (argOut.getByteArray()[0] == serDoubleTypeTag) {
-                            return (int) ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                        } else {
+                            throw new AlgebricksException(
+                                    "The precision argument for round-half-to-even should be an integer.");
                         }
-
-                        return 0;
                     }
 
                     @SuppressWarnings("unchecked")
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
index f975579..f53ebe8 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
@@ -4,7 +4,6 @@
 import java.io.IOException;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
@@ -67,10 +66,6 @@
                             } catch (AsterixException e) {
                                 throw new AlgebricksException(e);
                             }
-                            if (listAccessor.getItemType() == ATypeTag.NULL) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
                             try {
                                 // calculate length first
                                 int utf8Len = 0;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
index c379c3e3..67334ce 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
@@ -5,20 +5,16 @@
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
 import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -37,7 +33,6 @@
         }
     };
     private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
     private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
     private final byte stringTypeTag = ATypeTag.STRING.serialize();
 
@@ -58,9 +53,6 @@
                     private ArrayBackedValueStorage outInputSep = new ArrayBackedValueStorage();
                     private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
                     private ICopyEvaluator evalSep = sepEvalFactory.createEvaluator(outInputSep);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -72,20 +64,14 @@
                             outInputSep.reset();
                             evalSep.evaluate(tuple);
                             byte[] serSep = outInputSep.getByteArray();
-                            if (serOrderedList[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
                             if (serOrderedList[0] != SER_ORDEREDLIST_TYPE_TAG) {
-                                throw new AlgebricksException("Expects String List."
+                                throw new AlgebricksException("Expects String List but got "
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
                             }
 
-                            if (serSep[0] == SER_NULL_TYPE_TAG) {
-                            }
                             if (serSep[0] != SER_STRING_TYPE_TAG) {
-                                throw new AlgebricksException("Expects String as Seperator."
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
+                                throw new AlgebricksException("Expects String as Seperator but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serSep[0]));
                             }
 
                             int size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
index fdd45e2..3d845e1 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
@@ -7,7 +7,6 @@
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.AInt32;
 import edu.uci.ics.asterix.om.base.AMutableInt32;
-import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -43,7 +42,6 @@
         }
     };
     private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
 
     @Override
     public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
@@ -62,9 +60,6 @@
                     private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
 
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<AInt32> int32Serde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.AINT32);
                     private final AMutableInt32 aInt32 = new AMutableInt32(0);
@@ -123,9 +118,7 @@
 
                                 }
                                 listBuilder.write(out, true);
-                            } else if (serString[0] == SER_NULL_TYPE_TAG)
-                                nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else
                                 throw new AlgebricksException("Expects String Type.");
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1.getMessage());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
index fb01e97..21d098a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
@@ -21,7 +21,6 @@
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem.Fields;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -81,8 +80,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     private GregorianCalendarSystem calInstance = GregorianCalendarSystem.getInstance();
 
                     @Override
@@ -111,12 +108,7 @@
                                                 + argOut1.getByteArray()[0]);
                             }
 
-                            int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
-
-                            charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-
-                            int timezone = ATimeParserFactory.parseTimezonePart(charAccessor, 0);
+                            int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
 
                             if (!calInstance.validateTimeZone(timezone)) {
                                 throw new AlgebricksException("Wrong format for a time zone string!");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
index 1323664..1f8842e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
@@ -21,7 +21,6 @@
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
-import edu.uci.ics.asterix.om.base.temporal.ByteArrayCharSequenceAccessor;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem.Fields;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -81,8 +80,6 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-                    private ByteArrayCharSequenceAccessor charAccessor = new ByteArrayCharSequenceAccessor();
-
                     private GregorianCalendarSystem calInstance = GregorianCalendarSystem.getInstance();
 
                     @Override
@@ -111,12 +108,7 @@
                                                 + argOut1.getByteArray()[0]);
                             }
 
-                            int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                    + (argOut0.getByteArray()[2] & 0xff << 0);
-
-                            charAccessor.reset(argOut1.getByteArray(), 3, stringLength);
-
-                            int timezone = ATimeParserFactory.parseTimezonePart(charAccessor, 0);
+                            int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
 
                             if (!calInstance.validateTimeZone(timezone)) {
                                 throw new AlgebricksException("Wrong format for a time zone string!");
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
index c6be030..cbd600f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
@@ -186,9 +186,9 @@
                                 }
 
                                 if (day < 0) {
-                                    boolean isLeapYear = calInstanct.isLeapYear(year0);
-                                    day += (isLeapYear) ? (GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month0 - 1])
-                                            : (GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month0 - 1]);
+                                    boolean isLeapYear = calInstanct.isLeapYear(year1);
+                                    day += (isLeapYear) ? (GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month1 - 2])
+                                            : (GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month1 - 2]);
                                     month -= 1;
                                 }
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
index 2c7a9a7..8df3c7f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
@@ -124,13 +124,13 @@
 
                             if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
                                 throw new AlgebricksException(
-                                        "Inapplicable input type for parameter 0: expecting ADateTime, but got: "
+                                        "Inapplicable input type for parameter 0: expecting Datetime, but got: "
                                                 + argOut0.getByteArray()[0]);
                             }
 
                             if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
                                 throw new AlgebricksException(
-                                        "Inapplicable input type for parameter 1: expecting ADateTime, but got: "
+                                        "Inapplicable input type for parameter 1: expecting Duration, but got: "
                                                 + argOut1.getByteArray()[0]);
                             }
 
@@ -202,9 +202,9 @@
                                 }
 
                                 if (day < 0) {
-                                    boolean isLeapYear = calInstanct.isLeapYear(year0);
-                                    day += (isLeapYear) ? (GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month0 - 1])
-                                            : (GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month0 - 1]);
+                                    boolean isLeapYear = calInstanct.isLeapYear(year1);
+                                    day += (isLeapYear) ? (GregorianCalendarSystem.DAYS_OF_MONTH_LEAP[month1 - 2])
+                                            : (GregorianCalendarSystem.DAYS_OF_MONTH_ORDI[month1 - 2]);
                                     month -= 1;
                                 }
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index 2e64ad4..b32110b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -234,7 +234,7 @@
                 try {
                     if (checkType(ATypeTag.INTERVAL, objectType, out)) {
                         if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_OPEN) {
-                            if (admLexer.next() == AdmLexer.TOKEN_STRING_CONS) {
+                            if (admLexer.next() == AdmLexer.TOKEN_STRING_LITERAL) {
                                 AIntervalSerializerDeserializer.parseDate(admLexer.getLastTokenImage(), out);
 
                                 if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_CLOSE) {
@@ -252,7 +252,7 @@
                 try {
                     if (checkType(ATypeTag.INTERVAL, objectType, out)) {
                         if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_OPEN) {
-                            if (admLexer.next() == AdmLexer.TOKEN_STRING_CONS) {
+                            if (admLexer.next() == AdmLexer.TOKEN_STRING_LITERAL) {
                                 AIntervalSerializerDeserializer.parseTime(admLexer.getLastTokenImage(), out);
 
                                 if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_CLOSE) {
@@ -270,7 +270,7 @@
                 try {
                     if (checkType(ATypeTag.INTERVAL, objectType, out)) {
                         if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_OPEN) {
-                            if (admLexer.next() == AdmLexer.TOKEN_STRING_CONS) {
+                            if (admLexer.next() == AdmLexer.TOKEN_STRING_LITERAL) {
                                 AIntervalSerializerDeserializer.parseDatetime(admLexer.getLastTokenImage(), out);
 
                                 if (admLexer.next() == AdmLexer.TOKEN_CONSTRUCTOR_CLOSE) {
diff --git a/asterix-runtime/src/main/resources/adm.grammar b/asterix-runtime/src/main/resources/adm.grammar
index 56c7212..4d4158f 100644
--- a/asterix-runtime/src/main/resources/adm.grammar
+++ b/asterix-runtime/src/main/resources/adm.grammar
@@ -26,9 +26,9 @@
 RECTANGLE_CONS = string(rectangle)
 CIRCLE_CONS    = string(circle)
 TIME_CONS      = string(time)
-INTERVAL_TIME_CONS      = string(interval_time)
-INTERVAL_DATE_CONS      = string(interval_date)
-INTERVAL_DATETIME_CONS  = string(interval_datetime)
+INTERVAL_TIME_CONS      = string(interval-time)
+INTERVAL_DATE_CONS      = string(interval-date)
+INTERVAL_DATETIME_CONS  = string(interval-datetime)
 
 NULL_LITERAL   = string(null)
 TRUE_LITERAL   = string(true)