Preston Carman has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1234

Change subject: Interval join test questions for AQL.
......................................................................

Interval join test questions for AQL.

Change-Id: I3e492d1afba693a50cb75918399c26b8ce19899a
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
A asterixdb/asterix-app/data/tinycollege/staff.adm
A asterixdb/asterix-app/data/tinycollege/students.adm
A 
asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
A 
asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/TemporalQueries.xml
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.1.ddl.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.2.update.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.3.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.4.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.4.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalLogic.java
50 files changed, 1,510 insertions(+), 178 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/34/1234/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
index 80cdb21..15cda86 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
@@ -19,7 +19,9 @@
 package org.apache.asterix.optimizer.rules.temporal;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -45,6 +47,16 @@
  */
 public class TranslateIntervalExpressionRule implements IAlgebraicRewriteRule {
 
+    private static final Set<FunctionIdentifier> TRANSLATABLE_INTERVALS = new 
HashSet<>();
+    {
+        TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_MEETS);
+        TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_MET_BY);
+        TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_STARTS);
+        
TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_STARTED_BY);
+        TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_ENDS);
+        TRANSLATABLE_INTERVALS.add(AsterixBuiltinFunctions.INTERVAL_ENDED_BY);
+    }
+
     @Override
     public boolean rewritePre(Mutable<ILogicalOperator> opRef, 
IOptimizationContext context)
             throws AlgebricksException {
@@ -61,7 +73,6 @@
         SelectOperator selectOp = (SelectOperator) op;
 
         Mutable<ILogicalExpression> exprRef = selectOp.getCondition();
-        boolean modified = false;
         ILogicalExpression expr = exprRef.getValue();
         if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
             return false;
@@ -70,51 +81,96 @@
         if (funcExpr.getArguments().size() != 2) {
             return false;
         }
+        if (!hasTranslatableInterval(funcExpr)) {
+            return false;
+        }
+
+        return translateIntervalExpression(exprRef, funcExpr);
+    }
+
+    private boolean hasTranslatableInterval(AbstractFunctionCallExpression 
funcExpr) {
+        if (TRANSLATABLE_INTERVALS.contains(funcExpr.getFunctionIdentifier())) 
{
+            return true;
+        }
+        return false;
+    }
+
+    private boolean translateIntervalExpression(Mutable<ILogicalExpression> 
exprRef,
+            AbstractFunctionCallExpression funcExpr) {
+        // All interval relations are translated unless specified in a hint.
+        // TODO A new strategy may be needed instead of just a simple 
translation.
         ILogicalExpression interval1 = 
funcExpr.getArguments().get(0).getValue();
         ILogicalExpression interval2 = 
funcExpr.getArguments().get(1).getValue();
         if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_MEETS))
 {
             exprRef.setValue(getEqualExpr(getIntervalEndExpr(interval1), 
getIntervalStartExpr(interval2)));
-            modified = true;
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_MET_BY))
 {
             exprRef.setValue(getEqualExpr(getIntervalStartExpr(interval1), 
getIntervalEndExpr(interval2)));
-            modified = true;
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_STARTS))
 {
             ILogicalExpression startExpr = 
getEqualExpr(getIntervalStartExpr(interval1),
                     getIntervalStartExpr(interval2));
             ILogicalExpression endExpr = 
getLessThanOrEqualExpr(getIntervalEndExpr(interval1),
                     getIntervalEndExpr(interval2));
             exprRef.setValue(getAndExpr(startExpr, endExpr));
-            modified = true;
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_STARTED_BY))
 {
             ILogicalExpression startExpr = 
getEqualExpr(getIntervalStartExpr(interval1),
                     getIntervalStartExpr(interval2));
             ILogicalExpression endExpr = 
getLessThanOrEqualExpr(getIntervalEndExpr(interval2),
                     getIntervalEndExpr(interval1));
             exprRef.setValue(getAndExpr(startExpr, endExpr));
-            modified = true;
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_ENDS))
 {
             ILogicalExpression endExpr = 
getEqualExpr(getIntervalEndExpr(interval1), getIntervalEndExpr(interval2));
             ILogicalExpression startExpr = 
getLessThanOrEqualExpr(getIntervalStartExpr(interval1),
                     getIntervalStartExpr(interval2));
             exprRef.setValue(getAndExpr(startExpr, endExpr));
-            modified = true;
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_ENDED_BY))
 {
             ILogicalExpression endExpr = 
getEqualExpr(getIntervalEndExpr(interval1), getIntervalEndExpr(interval2));
             ILogicalExpression startExpr = 
getLessThanOrEqualExpr(getIntervalStartExpr(interval2),
                     getIntervalStartExpr(interval1));
             exprRef.setValue(getAndExpr(startExpr, endExpr));
-            modified = true;
-        } else if 
(funcExpr.getFunctionInfo().equals(AsterixBuiltinFunctions.INTERVAL_BEFORE)) {
-            // Requires new strategy, no translation for this interval and the 
remaining listed.
+        } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_BEFORE))
 {
+            exprRef.setValue(getLessThanExpr(getIntervalEndExpr(interval1), 
getIntervalStartExpr(interval2)));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_AFTER))
 {
+            
exprRef.setValue(getGreaterThanExpr(getIntervalStartExpr(interval1), 
getIntervalEndExpr(interval2)));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPS))
 {
+            ILogicalExpression expr1 = 
getLessThanExpr(getIntervalStartExpr(interval1),
+                    getIntervalStartExpr(interval2));
+            ILogicalExpression expr2 = 
getGreaterThanExpr(getIntervalEndExpr(interval2), 
getIntervalEndExpr(interval1));
+            ILogicalExpression expr3 = 
getGreaterThanExpr(getIntervalEndExpr(interval1),
+                    getIntervalStartExpr(interval2));
+            exprRef.setValue(getAndExpr(getAndExpr(expr1, expr2), expr3));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY))
 {
+            ILogicalExpression expr1 = 
getLessThanExpr(getIntervalStartExpr(interval2),
+                    getIntervalStartExpr(interval1));
+            ILogicalExpression expr2 = 
getGreaterThanExpr(getIntervalEndExpr(interval1), 
getIntervalEndExpr(interval2));
+            ILogicalExpression expr3 = 
getGreaterThanExpr(getIntervalEndExpr(interval2),
+                    getIntervalStartExpr(interval1));
+            exprRef.setValue(getAndExpr(getAndExpr(expr1, expr2), expr3));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING))
 {
+            ILogicalExpression startExpr = 
getLessThanOrEqualExpr(getIntervalStartExpr(interval1),
+                    getIntervalEndExpr(interval2));
+            ILogicalExpression endExpr = 
getGreaterThanOrEqualExpr(getIntervalEndExpr(interval1),
+                    getIntervalStartExpr(interval2));
+            ILogicalExpression startPointExpr = 
getNotEqualExpr(getIntervalEndExpr(interval1),
+                    getIntervalStartExpr(interval2));
+            ILogicalExpression endPointExpr = 
getNotEqualExpr(getIntervalStartExpr(interval1),
+                    getIntervalEndExpr(interval2));
+            exprRef.setValue(getAndExpr(getAndExpr(startExpr, endExpr), 
getAndExpr(startPointExpr, endPointExpr)));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_COVERS))
 {
+            ILogicalExpression startExpr = 
getLessThanOrEqualExpr(getIntervalStartExpr(interval1),
+                    getIntervalStartExpr(interval2));
+            ILogicalExpression endExpr = 
getGreaterThanOrEqualExpr(getIntervalEndExpr(interval1),
+                    getIntervalEndExpr(interval2));
+            exprRef.setValue(getAndExpr(startExpr, endExpr));
         } else if 
(funcExpr.getFunctionIdentifier().equals(AsterixBuiltinFunctions.INTERVAL_COVERED_BY))
 {
+            ILogicalExpression startExpr = 
getLessThanOrEqualExpr(getIntervalStartExpr(interval2),
+                    getIntervalStartExpr(interval1));
+            ILogicalExpression endExpr = 
getGreaterThanOrEqualExpr(getIntervalEndExpr(interval2),
+                    getIntervalEndExpr(interval1));
+            exprRef.setValue(getAndExpr(startExpr, endExpr));
+        } else {
+            return false;
         }
-
-        return modified;
+        return true;
     }
 
     private ILogicalExpression getAndExpr(ILogicalExpression arg1, 
ILogicalExpression arg2) {
@@ -125,8 +181,24 @@
         return getScalarExpr(AlgebricksBuiltinFunctions.EQ, arg1, arg2);
     }
 
+    private ILogicalExpression getNotEqualExpr(ILogicalExpression arg1, 
ILogicalExpression arg2) {
+        return getScalarExpr(AlgebricksBuiltinFunctions.NEQ, arg1, arg2);
+    }
+
+    private ILogicalExpression getLessThanExpr(ILogicalExpression arg1, 
ILogicalExpression arg2) {
+        return getScalarExpr(AlgebricksBuiltinFunctions.LT, arg1, arg2);
+    }
+
     private ILogicalExpression getLessThanOrEqualExpr(ILogicalExpression arg1, 
ILogicalExpression arg2) {
         return getScalarExpr(AlgebricksBuiltinFunctions.LE, arg1, arg2);
+    }
+
+    private ILogicalExpression getGreaterThanExpr(ILogicalExpression arg1, 
ILogicalExpression arg2) {
+        return getScalarExpr(AlgebricksBuiltinFunctions.GT, arg1, arg2);
+    }
+
+    private ILogicalExpression getGreaterThanOrEqualExpr(ILogicalExpression 
arg1, ILogicalExpression arg2) {
+        return getScalarExpr(AlgebricksBuiltinFunctions.GE, arg1, arg2);
     }
 
     private ILogicalExpression getIntervalStartExpr(ILogicalExpression 
interval) {
@@ -138,14 +210,14 @@
     }
 
     private ILogicalExpression getScalarExpr(FunctionIdentifier func, 
ILogicalExpression interval) {
-        List<Mutable<ILogicalExpression>> intervalArg = new 
ArrayList<Mutable<ILogicalExpression>>();
+        List<Mutable<ILogicalExpression>> intervalArg = new ArrayList<>();
         intervalArg.add(new MutableObject<ILogicalExpression>(interval));
         return new 
ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(func), intervalArg);
     }
 
     private ILogicalExpression getScalarExpr(FunctionIdentifier func, 
ILogicalExpression interval1,
             ILogicalExpression interval2) {
-        List<Mutable<ILogicalExpression>> intervalArg = new 
ArrayList<Mutable<ILogicalExpression>>();
+        List<Mutable<ILogicalExpression>> intervalArg = new ArrayList<>();
         intervalArg.add(new MutableObject<ILogicalExpression>(interval1));
         intervalArg.add(new MutableObject<ILogicalExpression>(interval2));
         return new 
ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(func), intervalArg);
diff --git a/asterixdb/asterix-app/data/tinycollege/staff.adm 
b/asterixdb/asterix-app/data/tinycollege/staff.adm
new file mode 100644
index 0000000..4bfdd4b
--- /dev/null
+++ b/asterixdb/asterix-app/data/tinycollege/staff.adm
@@ -0,0 +1,7 @@
+{ "id": 14, "name": "Alex", "office": "A", "employment": 
interval(date("2003-01-01"), date("2008-01-01")) }
+{ "id": 13, "name": "Elisabeth", "office": "B", "employment": 
interval(date("2002-01-01"), date("2010-01-01")) }
+{ "id": 16, "name": "Franklin", "office": "A", "employment": 
interval(date("2004-01-01"), date("2009-01-01")) }
+{ "id": 15, "name": "Henry", "office": "C", "employment": 
interval(date("2003-01-01"), date("2008-01-01")) }
+{ "id": 17, "name": "Maryann", "office": "B", "employment": 
interval(date("2006-01-01"), date("2010-01-01")) }
+{ "id": 11, "name": "Vicky", "office": "D", "employment": 
interval(date("2001-01-01"), date("2010-01-01")) }
+{ "id": 12, "name": "Zack", "office": "A", "employment": 
interval(date("2002-01-01"), date("2003-01-01")) }
diff --git a/asterixdb/asterix-app/data/tinycollege/students.adm 
b/asterixdb/asterix-app/data/tinycollege/students.adm
new file mode 100644
index 0000000..b869075
--- /dev/null
+++ b/asterixdb/asterix-app/data/tinycollege/students.adm
@@ -0,0 +1,7 @@
+{ "id": 22, "name": "Charles", "office": "X", "attendance": 
interval(date("2001-01-01"), date("2004-01-01")) }
+{ "id": 23, "name": "Frank", "office": "Y", "attendance": 
interval(date("2001-01-01"), date("2004-01-01")) }
+{ "id": 25, "name": "Karen", "office": "Y", "attendance": 
interval(date("2007-01-01"), date("2009-01-01")) }
+{ "id": 24, "name": "Mary", "office": "Y", "attendance": 
interval(date("2002-01-01"), date("2005-01-01")) }
+{ "id": 21, "name": "Olga", "office": "Z", "attendance": 
interval(date("2001-01-01"), date("2003-01-01")) }
+{ "id": 26, "name": "Steve", "office": "Z", "attendance": 
interval(date("2007-01-01"), date("2010-01-01")) }
+{ "id": 27, "name": "Tess", "office": "X", "attendance": 
interval(date("2008-01-01"), date("2010-01-01")) }
diff --git 
a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
 
b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
new file mode 100644
index 0000000..4ecd143
--- /dev/null
+++ 
b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
@@ -0,0 +1,35 @@
+{ "staff": "Alex", "student": "Charles" }
+{ "staff": "Alex", "student": "Frank" }
+{ "staff": "Alex", "student": "Karen" }
+{ "staff": "Alex", "student": "Mary" }
+{ "staff": "Alex", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Charles" }
+{ "staff": "Elisabeth", "student": "Frank" }
+{ "staff": "Elisabeth", "student": "Karen" }
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Olga" }
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Franklin", "student": "Mary" }
+{ "staff": "Franklin", "student": "Steve" }
+{ "staff": "Franklin", "student": "Tess" }
+{ "staff": "Henry", "student": "Charles" }
+{ "staff": "Henry", "student": "Frank" }
+{ "staff": "Henry", "student": "Karen" }
+{ "staff": "Henry", "student": "Mary" }
+{ "staff": "Henry", "student": "Steve" }
+{ "staff": "Maryann", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Karen" }
+{ "staff": "Vicky", "student": "Mary" }
+{ "staff": "Vicky", "student": "Olga" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
+{ "staff": "Zack", "student": "Charles" }
+{ "staff": "Zack", "student": "Frank" }
+{ "staff": "Zack", "student": "Mary" }
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
 
b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
new file mode 100644
index 0000000..4ecd143
--- /dev/null
+++ 
b/asterixdb/asterix-app/rttest/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
@@ -0,0 +1,35 @@
+{ "staff": "Alex", "student": "Charles" }
+{ "staff": "Alex", "student": "Frank" }
+{ "staff": "Alex", "student": "Karen" }
+{ "staff": "Alex", "student": "Mary" }
+{ "staff": "Alex", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Charles" }
+{ "staff": "Elisabeth", "student": "Frank" }
+{ "staff": "Elisabeth", "student": "Karen" }
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Olga" }
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Franklin", "student": "Mary" }
+{ "staff": "Franklin", "student": "Steve" }
+{ "staff": "Franklin", "student": "Tess" }
+{ "staff": "Henry", "student": "Charles" }
+{ "staff": "Henry", "student": "Frank" }
+{ "staff": "Henry", "student": "Karen" }
+{ "staff": "Henry", "student": "Mary" }
+{ "staff": "Henry", "student": "Steve" }
+{ "staff": "Maryann", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Karen" }
+{ "staff": "Vicky", "student": "Mary" }
+{ "staff": "Vicky", "student": "Olga" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
+{ "staff": "Zack", "student": "Charles" }
+{ "staff": "Zack", "student": "Frank" }
+{ "staff": "Zack", "student": "Mary" }
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/TemporalQueries.xml
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/TemporalQueries.xml
new file mode 100644
index 0000000..94030df
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/TemporalQueries.xml
@@ -0,0 +1,186 @@
+<!--
+ ! Copyright 2009-2013 by The Regents of the University of California
+ ! Licensed under the Apache License, Version 2.0 (the "License");
+ ! you may not use this file except in compliance with the License.
+ ! you may obtain a copy of the License from
+ !
+ !     http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_3">
+                <output-dir compare="Text">overlap_bins_gby_3</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="agg_01">
+                <output-dir compare="Text">agg_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_1">
+                <output-dir compare="Text">overlap_bins_gby_1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="duration_functions">
+                <output-dir compare="Text">duration_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_0">
+                <output-dir compare="Text">overlap_bins_gby_0</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="get_overlapping_interval">
+                <output-dir 
compare="Text">get_overlapping_interval</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins">
+                <output-dir compare="Text">overlap_bins</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="parse_02">
+                <output-dir compare="Text">parse_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="parse_01">
+                <output-dir compare="Text">parse_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="day_of_week_01">
+                <output-dir compare="Text">day_of_week_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="interval_bin">
+                <output-dir compare="Text">interval_bin</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="interval_bin_gby_0">
+                <output-dir compare="Text">interval_bin_gby_0</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="interval_bin_gby_1">
+                <output-dir compare="Text">interval_bin_gby_1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="accessors">
+                <output-dir compare="Text">accessors</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="accessors_interval">
+                <output-dir compare="Text">accessors_interval</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="accessors_interval_null">
+                <output-dir compare="Text">accessors_interval_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="adjust_timezone">
+                <output-dir compare="Text">adjust_timezone</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="calendar_duration">
+                <output-dir compare="Text">calendar_duration</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="date_functions">
+                <output-dir compare="Text">date_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="datetime_functions">
+                <output-dir compare="Text">datetime_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <!--
+        <test-case FilePath="temporal">
+            <compilation-unit name="insert_from_delimited_ds">
+                <output-dir 
compare="Text">insert_from_delimited_ds</output-dir>
+            </compilation-unit>
+        </test-case>
+        -->
+        <test-case FilePath="temporal">
+            <compilation-unit name="insert_from_ext_ds">
+                <output-dir compare="Text">insert_from_ext_ds</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="insert_from_ext_ds_2">
+                <output-dir compare="Text">insert_from_ext_ds_2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="interval_functions">
+                <output-dir compare="Text">interval_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_before">
+                <output-dir compare="Text">interval_before</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_covers">
+                <output-dir compare="Text">interval_covers</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_ends">
+                <output-dir compare="Text">interval_ends</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_meets">
+                <output-dir compare="Text">interval_meets</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_overlapping">
+                <output-dir compare="Text">interval_overlapping</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_overlaps">
+                <output-dir compare="Text">interval_overlaps</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal/interval_joins">
+            <compilation-unit name="interval_starts">
+                <output-dir compare="Text">interval_starts</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="time_functions">
+                <output-dir compare="Text">time_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="constructor">
+            <compilation-unit name="interval">
+                <output-dir compare="Text">interval</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="duration_comps">
+                <output-dir compare="Text">duration_comps</output-dir>
+            </compilation-unit>
+        </test-case>
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.3.query.aql
new file mode 100644
index 0000000..f1c4ef6
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-before($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.4.query.aql
new file mode 100644
index 0000000..b2b7e56
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_before/interval_before.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-before($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.3.query.aql
new file mode 100644
index 0000000..cf14c45
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-covers($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.4.query.aql
new file mode 100644
index 0000000..9393274
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_covers/interval_covers.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-covers($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.3.query.aql
new file mode 100644
index 0000000..4e6b378
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-ends($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.4.query.aql
new file mode 100644
index 0000000..9d9f8b5
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_ends/interval_ends.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-ends($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.3.query.aql
new file mode 100644
index 0000000..3f74ed5
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-meets($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.4.query.aql
new file mode 100644
index 0000000..6ebaa96
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_meets/interval_meets.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-meets($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.3.query.aql
new file mode 100644
index 0000000..d59e614
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-overlapping($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.4.query.aql
new file mode 100644
index 0000000..9ffe880
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-overlapping($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.3.query.aql
new file mode 100644
index 0000000..bc0252b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-overlaps($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.4.query.aql
new file mode 100644
index 0000000..a441fe2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlaps/interval_overlaps.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-overlaps($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.1.ddl.aql
new file mode 100644
index 0000000..8062540
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.1.ddl.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+drop dataverse TinyCollege if exists;
+create dataverse TinyCollege;
+use dataverse TinyCollege;
+
+create type StaffType as open {
+        name: string,
+        office: string,
+        employment: interval
+}
+create dataset Staff(StaffType)
+primary key name;
+
+
+create type StudentType as open {
+        name: string,
+        office: string,
+        attendance: interval
+}
+create dataset Students(StudentType)
+primary key name;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.2.update.aql
new file mode 100644
index 0000000..ec2fdb0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.2.update.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+load dataset Staff using localfs
+(("path"="asterix_nc1://data/tinycollege/staff.adm"),("format"="adm"));
+
+load dataset Students using localfs
+(("path"="asterix_nc1://data/tinycollege/students.adm"),("format"="adm"));
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.3.query.aql
new file mode 100644
index 0000000..8a1e561
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-starts($f.employment, $d.attendance)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.4.query.aql
new file mode 100644
index 0000000..742f9ef
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_starts/interval_starts.4.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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.
+ */
+/*
+ * Description      :   Check temporal join functionality for interval
+ * Expected Result  :   Success
+ * Date             :   26th Jun, 2015
+ */
+
+use dataverse TinyCollege;
+
+for $f in dataset Staff
+for $d in dataset Students
+where interval-starts($d.attendance, $f.employment)
+order by $f.name, $d.name
+return { "staff" : $f.name, "student" : $d.name }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.3.adm
new file mode 100644
index 0000000..509693a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.3.adm
@@ -0,0 +1,3 @@
+{ "staff": "Zack", "student": "Karen" }
+{ "staff": "Zack", "student": "Steve" }
+{ "staff": "Zack", "student": "Tess" }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.4.adm
new file mode 100644
index 0000000..f38e40b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_before/interval_before.4.adm
@@ -0,0 +1,5 @@
+{ "staff": "Franklin", "student": "Olga" }
+{ "staff": "Maryann", "student": "Charles" }
+{ "staff": "Maryann", "student": "Frank" }
+{ "staff": "Maryann", "student": "Mary" }
+{ "staff": "Maryann", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.3.adm
new file mode 100644
index 0000000..4e22101
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.3.adm
@@ -0,0 +1,15 @@
+{ "staff": "Elisabeth", "student": "Karen" }
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Maryann", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Karen" }
+{ "staff": "Vicky", "student": "Mary" }
+{ "staff": "Vicky", "student": "Olga" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.4.adm
new file mode 100644
index 0000000..1a67e10
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_covers/interval_covers.4.adm
@@ -0,0 +1,4 @@
+{ "staff": "Zack", "student": "Charles" }
+{ "staff": "Zack", "student": "Frank" }
+{ "staff": "Zack", "student": "Mary" }
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.3.adm
new file mode 100644
index 0000000..5af9101
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.3.adm
@@ -0,0 +1,7 @@
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.4.adm
new file mode 100644
index 0000000..5857139
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_ends/interval_ends.4.adm
@@ -0,0 +1 @@
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.3.adm
new file mode 100644
index 0000000..5568195
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.3.adm
@@ -0,0 +1,2 @@
+{ "staff": "Alex", "student": "Tess" }
+{ "staff": "Henry", "student": "Tess" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.4.adm
new file mode 100644
index 0000000..cd4b3ba
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_meets/interval_meets.4.adm
@@ -0,0 +1,4 @@
+{ "staff": "Alex", "student": "Olga" }
+{ "staff": "Franklin", "student": "Charles" }
+{ "staff": "Franklin", "student": "Frank" }
+{ "staff": "Henry", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
new file mode 100644
index 0000000..4ecd143
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.3.adm
@@ -0,0 +1,35 @@
+{ "staff": "Alex", "student": "Charles" }
+{ "staff": "Alex", "student": "Frank" }
+{ "staff": "Alex", "student": "Karen" }
+{ "staff": "Alex", "student": "Mary" }
+{ "staff": "Alex", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Charles" }
+{ "staff": "Elisabeth", "student": "Frank" }
+{ "staff": "Elisabeth", "student": "Karen" }
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Olga" }
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Franklin", "student": "Mary" }
+{ "staff": "Franklin", "student": "Steve" }
+{ "staff": "Franklin", "student": "Tess" }
+{ "staff": "Henry", "student": "Charles" }
+{ "staff": "Henry", "student": "Frank" }
+{ "staff": "Henry", "student": "Karen" }
+{ "staff": "Henry", "student": "Mary" }
+{ "staff": "Henry", "student": "Steve" }
+{ "staff": "Maryann", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Karen" }
+{ "staff": "Vicky", "student": "Mary" }
+{ "staff": "Vicky", "student": "Olga" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
+{ "staff": "Zack", "student": "Charles" }
+{ "staff": "Zack", "student": "Frank" }
+{ "staff": "Zack", "student": "Mary" }
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
new file mode 100644
index 0000000..4ecd143
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlapping/interval_overlapping.4.adm
@@ -0,0 +1,35 @@
+{ "staff": "Alex", "student": "Charles" }
+{ "staff": "Alex", "student": "Frank" }
+{ "staff": "Alex", "student": "Karen" }
+{ "staff": "Alex", "student": "Mary" }
+{ "staff": "Alex", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Charles" }
+{ "staff": "Elisabeth", "student": "Frank" }
+{ "staff": "Elisabeth", "student": "Karen" }
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Olga" }
+{ "staff": "Elisabeth", "student": "Steve" }
+{ "staff": "Elisabeth", "student": "Tess" }
+{ "staff": "Franklin", "student": "Karen" }
+{ "staff": "Franklin", "student": "Mary" }
+{ "staff": "Franklin", "student": "Steve" }
+{ "staff": "Franklin", "student": "Tess" }
+{ "staff": "Henry", "student": "Charles" }
+{ "staff": "Henry", "student": "Frank" }
+{ "staff": "Henry", "student": "Karen" }
+{ "staff": "Henry", "student": "Mary" }
+{ "staff": "Henry", "student": "Steve" }
+{ "staff": "Maryann", "student": "Karen" }
+{ "staff": "Maryann", "student": "Steve" }
+{ "staff": "Maryann", "student": "Tess" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Karen" }
+{ "staff": "Vicky", "student": "Mary" }
+{ "staff": "Vicky", "student": "Olga" }
+{ "staff": "Vicky", "student": "Steve" }
+{ "staff": "Vicky", "student": "Tess" }
+{ "staff": "Zack", "student": "Charles" }
+{ "staff": "Zack", "student": "Frank" }
+{ "staff": "Zack", "student": "Mary" }
+{ "staff": "Zack", "student": "Olga" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.3.adm
new file mode 100644
index 0000000..94ac56a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.3.adm
@@ -0,0 +1,6 @@
+{ "staff": "Alex", "student": "Karen" }
+{ "staff": "Alex", "student": "Steve" }
+{ "staff": "Franklin", "student": "Steve" }
+{ "staff": "Franklin", "student": "Tess" }
+{ "staff": "Henry", "student": "Karen" }
+{ "staff": "Henry", "student": "Steve" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.4.adm
new file mode 100644
index 0000000..9e5549f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_overlaps/interval_overlaps.4.adm
@@ -0,0 +1,10 @@
+{ "staff": "Alex", "student": "Charles" }
+{ "staff": "Alex", "student": "Frank" }
+{ "staff": "Alex", "student": "Mary" }
+{ "staff": "Elisabeth", "student": "Charles" }
+{ "staff": "Elisabeth", "student": "Frank" }
+{ "staff": "Elisabeth", "student": "Olga" }
+{ "staff": "Franklin", "student": "Mary" }
+{ "staff": "Henry", "student": "Charles" }
+{ "staff": "Henry", "student": "Frank" }
+{ "staff": "Henry", "student": "Mary" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.3.adm
new file mode 100644
index 0000000..54ab54e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.3.adm
@@ -0,0 +1 @@
+{ "staff": "Zack", "student": "Mary" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.4.adm
new file mode 100644
index 0000000..6cd921a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/temporal/interval_joins/interval_starts/interval_starts.4.adm
@@ -0,0 +1,4 @@
+{ "staff": "Elisabeth", "student": "Mary" }
+{ "staff": "Vicky", "student": "Charles" }
+{ "staff": "Vicky", "student": "Frank" }
+{ "staff": "Vicky", "student": "Olga" }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 0a45cdf..b4b722b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -16,19 +16,19 @@
  ! specific language governing permissions and limitations
  ! under the License.
  !-->
+<!-- Keep test-suite list in Alphabetical order. -->
 <!DOCTYPE test-suite [
 
-             <!ENTITY ComparisonQueries SYSTEM 
"queries/comparison/ComparisonQueries.xml">
-             <!ENTITY RecordsQueries SYSTEM 
"queries/records/RecordsQueries.xml">
-             <!ENTITY DeepEqualQueries SYSTEM 
"queries/comparison/deep_equal/DeepEqualQueries.xml">
              <!ENTITY APIQueries SYSTEM "queries/api/APIQueries.xml">
+             <!ENTITY ComparisonQueries SYSTEM 
"queries/comparison/ComparisonQueries.xml">
+             <!ENTITY DeepEqualQueries SYSTEM 
"queries/comparison/deep_equal/DeepEqualQueries.xml">
+             <!ENTITY RecordsQueries SYSTEM 
"queries/records/RecordsQueries.xml">
+             <!ENTITY TemporalQueries SYSTEM 
"queries/temporal/TemporalQueries.xml">
+
              ]>
 
-<test-suite
-             xmlns="urn:xml.testframework.asterix.apache.org"
-             ResultOffsetPath="results"
-             QueryOffsetPath="queries"
-             QueryFileExtension=".aql">
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org" 
ResultOffsetPath="results" QueryOffsetPath="queries"
+  QueryFileExtension=".aql">
   &APIQueries;
   <test-group name="external-library">
     <test-case FilePath="external-library">
@@ -449,19 +449,22 @@
     <test-case FilePath="aggregate">
       <compilation-unit name="avg_mixed">
         <output-dir compare="Text">avg_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
       <compilation-unit name="sum_mixed">
         <output-dir compare="Text">sum_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
       <compilation-unit name="min_mixed">
         <output-dir compare="Text">min_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
@@ -910,19 +913,22 @@
     <test-case FilePath="aggregate-sql">
       <compilation-unit name="avg_mixed">
         <output-dir compare="Text">avg_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
       <compilation-unit name="sum_mixed">
         <output-dir compare="Text">sum_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
       <compilation-unit name="min_mixed">
         <output-dir compare="Text">min_mixed</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type STRING</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unexpected type
+          STRING</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
@@ -1552,7 +1558,9 @@
     <test-case FilePath="dml">
       <compilation-unit name="insert-duplicated-keys-from-query">
         <output-dir 
compare="Text">insert-duplicated-keys-from-query</output-dir>
-        
<expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException:
 Failed to insert key since key already exists</expected-error>
+        
<expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException:
 Failed
+          to insert
+          key since key already exists</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
@@ -1703,7 +1711,9 @@
     <test-case FilePath="dml">
       <compilation-unit name="insert-duplicated-keys">
         <output-dir compare="Text">insert-duplicated-keys</output-dir>
-        
<expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException:
 Failed to insert key since key already exists</expected-error>
+        
<expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException:
 Failed
+          to insert
+          key since key already exists</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
@@ -1726,7 +1736,8 @@
     <test-case FilePath="dml">
       <compilation-unit name="insert-with-autogenerated-pk_adm_02">
         <output-dir 
compare="Text">insert-with-autogenerated-pk_adm_02</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Duplicate field id encountered</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Duplicate field id
+          encountered</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
@@ -2537,7 +2548,9 @@
     <test-case FilePath="fuzzyjoin">
       <compilation-unit name="dblp-aqlplus_2">
         <output-dir compare="Text">dblp-aqlplus_2</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Invalid types STRING given as arguments to jaccard</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Invalid types
+          STRING given
+          as arguments to jaccard</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -3181,7 +3194,9 @@
     <test-case FilePath="meta">
       <compilation-unit name="query_dataset_with_meta_failure">
         <output-dir compare="Text">query_dataset_with_meta_failure</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Cannot resolve to ambiguity on the meta function call -- there are more than 
once dataset choices!</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Cannot resolve to
+          ambiguity
+          on the meta function call -- there are more than once dataset 
choices!</expected-error>
       </compilation-unit>
     </test-case>
   </test-group>
@@ -3191,7 +3206,8 @@
         <output-dir compare="Text">partition-by-nonexistent-field</output-dir>
         <expected-error>Type not found for partitioning key 
[id]</expected-error>
         
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Cannot find dataset</expected-error>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Could not find dataset</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Could not find
+          dataset</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="misc">
@@ -3304,25 +3320,33 @@
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="index-on-closed-type">
           <output-dir compare="Text">index-on-closed-type</output-dir>
-          
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Typed index on "[value]" field could be created only for open 
datatype</expected-error>
+          
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Typed index on
+            "[value]"
+            field could be created only for open datatype</expected-error>
         </compilation-unit>
       </test-case>
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="index-type-collision">
           <output-dir compare="Text">index-type-collision</output-dir>
-          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot 
create index testIdx2 , enforced index testIdx1 on field "[value]" is already 
defined with type "[INT32]"</expected-error>
+          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot 
create index testIdx2
+            , enforced
+            index testIdx1 on field "[value]" is already defined with type 
"[INT32]"</expected-error>
         </compilation-unit>
       </test-case>
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="index-type-promotion-collision">
           <output-dir 
compare="Text">index-type-promotion-collision</output-dir>
-          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot 
create index testIdx2 , enforced index testIdx1 on field "[value]" is already 
defined with type "[INT64]"</expected-error>
+          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: Cannot 
create index testIdx2
+            , enforced
+            index testIdx1 on field "[value]" is already defined with type 
"[INT64]"</expected-error>
         </compilation-unit>
       </test-case>
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="missing-enforce-statement">
           <output-dir compare="Text">missing-enforce-statement</output-dir>
-          
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Cannot create typed index on "[value]" field without enforcing it's 
type</expected-error>
+          
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Cannot create
+            typed index
+            on "[value]" field without enforcing it's type</expected-error>
         </compilation-unit>
       </test-case>
       <test-case FilePath="open-index-enforced/error-checking">
@@ -3334,7 +3358,9 @@
       <test-case FilePath="open-index-enforced/error-checking">
         <compilation-unit name="record-type-collision">
           <output-dir compare="Text">record-type-collision</output-dir>
-          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: A field 
"[value]" is already defined with the type "STRING"</expected-error>
+          
<expected-error>org.apache.asterix.common.exceptions.AsterixException: A field 
"[value]" is already
+            defined
+            with the type "STRING"</expected-error>
         </compilation-unit>
       </test-case>
     </test-group>
@@ -4867,7 +4893,7 @@
     </test-case>
     <test-case FilePath="scan">
       <compilation-unit name="alltypes_01">
-        <parameter name="wrapper-array" value="true"/>
+        <parameter name="wrapper-array" value="true" />
         <output-dir compare="Text">alltypes_01-wrapped</output-dir>
       </compilation-unit>
     </test-case>
@@ -4878,7 +4904,7 @@
     </test-case>
     <test-case FilePath="scan">
       <compilation-unit name="alltypes_01">
-        <parameter name="wrapper-array" value="false"/>
+        <parameter name="wrapper-array" value="false" />
         <output-dir 
compare="Lossless-JSON">alltypes_01-losslessjson-unwrapped</output-dir>
       </compilation-unit>
     </test-case>
@@ -6207,7 +6233,9 @@
     <test-case FilePath="cross-dataverse">
       <compilation-unit name="drop-dataverse">
         <output-dir compare="Text">drop-dataverse</output-dir>
-        <expected-error>org.apache.asterix.metadata.MetadataException: Cannot 
drop dataverse. Type a.a used by dataset b.b1</expected-error>
+        <expected-error>org.apache.asterix.metadata.MetadataException: Cannot 
drop dataverse. Type a.a used by
+          dataset
+          b.b1</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="cross-dataverse">
@@ -6555,7 +6583,9 @@
     <test-case FilePath="load">
       <compilation-unit name="issue650_query">
         <output-dir compare="Text">none</output-dir>
-        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unable to load dataset Users since it does not exist</expected-error>
+        
<expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
 Unable to load
+          dataset Users
+          since it does not exist</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
@@ -6709,138 +6739,7 @@
     </test-case>
   </test-group>
   <test-group name="temporal">
-    <test-case FilePath="temporal">
-      <compilation-unit name="overlap_bins_gby_3">
-        <output-dir compare="Text">overlap_bins_gby_3</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="agg_01">
-        <output-dir compare="Text">agg_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="overlap_bins_gby_1">
-        <output-dir compare="Text">overlap_bins_gby_1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="duration_functions">
-        <output-dir compare="Text">duration_functions</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="overlap_bins_gby_0">
-        <output-dir compare="Text">overlap_bins_gby_0</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="get_overlapping_interval">
-        <output-dir compare="Text">get_overlapping_interval</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="overlap_bins">
-        <output-dir compare="Text">overlap_bins</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="parse_02">
-        <output-dir compare="Text">parse_02</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="parse_01">
-        <output-dir compare="Text">parse_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="day_of_week_01">
-        <output-dir compare="Text">day_of_week_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="interval_bin">
-        <output-dir compare="Text">interval_bin</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="interval_bin_gby_0">
-        <output-dir compare="Text">interval_bin_gby_0</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="interval_bin_gby_1">
-        <output-dir compare="Text">interval_bin_gby_1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="accessors">
-        <output-dir compare="Text">accessors</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="accessors_interval">
-        <output-dir compare="Text">accessors_interval</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="accessors_interval_null">
-        <output-dir compare="Text">accessors_interval_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="adjust_timezone">
-        <output-dir compare="Text">adjust_timezone</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="calendar_duration">
-        <output-dir compare="Text">calendar_duration</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="date_functions">
-        <output-dir compare="Text">date_functions</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="datetime_functions">
-        <output-dir compare="Text">datetime_functions</output-dir>
-      </compilation-unit>
-    </test-case>
-    <!--
-    <test-case FilePath="temporal">
-      <compilation-unit name="insert_from_delimited_ds">
-        <output-dir compare="Text">insert_from_delimited_ds</output-dir>
-      </compilation-unit>
-    </test-case>
-    -->
-    <test-case FilePath="temporal">
-      <compilation-unit name="insert_from_ext_ds">
-        <output-dir compare="Text">insert_from_ext_ds</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="insert_from_ext_ds_2">
-        <output-dir compare="Text">insert_from_ext_ds_2</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="interval_functions">
-        <output-dir compare="Text">interval_functions</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="time_functions">
-        <output-dir compare="Text">time_functions</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="temporal">
-      <compilation-unit name="duration_comps">
-        <output-dir compare="Text">duration_comps</output-dir>
-      </compilation-unit>
-    </test-case>
+        &TemporalQueries;
   </test-group>
   <test-group name="leftouterjoin">
     <test-case FilePath="leftouterjoin">
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalLogic.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalLogic.java
index 23f0da3..9d364e1 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalLogic.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalLogic.java
@@ -115,10 +115,10 @@
         ip1.getEnd(e1);
         ip2.getStart(s2);
         ip2.getEnd(e2);
-        return (ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), s1, s2) <= 0
-                && ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), e1, s2) > 0)
-                || (ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), e1, e2) >= 0
-                        && ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), s1, 
e2) < 0);
+        return ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), s1, e2) <= 0
+                && ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), e1, s2) >= 0
+                && ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), e1, s2) != 0
+                && ch.compare(ip1.getTypeTag(), ip2.getTypeTag(), s1, e2) != 0;
     }
 
     /**

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1234
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e492d1afba693a50cb75918399c26b8ce19899a
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Preston Carman <[email protected]>

Reply via email to