asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject [06/50] [abbrv] asterixdb git commit: new annontations.
Date Mon, 17 Oct 2016 19:54:56 GMT
new annontations.


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/22d1dbcb
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/22d1dbcb
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/22d1dbcb

Branch: refs/heads/ecarm002/interval_join_merge
Commit: 22d1dbcba8e2b36074f852fd5015d5ae75e66168
Parents: fd84e34
Author: Preston Carman <prestonc@apache.org>
Authored: Fri Jul 8 16:30:46 2016 -0700
Committer: Preston Carman <prestonc@apache.org>
Committed: Fri Jul 8 16:30:46 2016 -0700

----------------------------------------------------------------------
 .../rules/IntervalSplitPartitioningRule.java    | 33 ++++----
 .../asterix/optimizer/rules/util/JoinUtils.java | 79 ++++++++------------
 .../interval_overlapping.11.query.aql           |  2 +-
 .../interval_overlapping.12.query.aql           |  2 +-
 .../IntervalJoinExpressionAnnotation.java       |  8 +-
 .../IntervalPartitionUtil.java                  | 30 +++++++-
 6 files changed, 86 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntervalSplitPartitioningRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntervalSplitPartitioningRule.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntervalSplitPartitioningRule.java
index 629606c..9df5a50 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntervalSplitPartitioningRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntervalSplitPartitioningRule.java
@@ -23,7 +23,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.asterix.algebra.operators.IntervalLocalRangeSplitterOperator;
 import org.apache.asterix.algebra.operators.physical.IntervalIndexJoinPOperator;
 import org.apache.asterix.algebra.operators.physical.IntervalLocalRangeSplitterPOperator;
 import org.apache.asterix.algebra.operators.physical.IntervalPartitionJoinPOperator;
@@ -43,13 +42,11 @@ import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import org.apache.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
 import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator.JoinKind;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.ExecutionMode;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator;
-import org.apache.hyracks.algebricks.core.algebra.operators.logical.ExtensionOperator;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.MaterializeOperator;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.OrderOperator;
@@ -97,21 +94,21 @@ public class IntervalSplitPartitioningRule implements IAlgebraicRewriteRule
{
 
     private static final int START_SPLITS = 3;
 
-    private static final Set<FunctionIdentifier> intervalJoinConditions = new HashSet<>();
+    private static final Set<FunctionIdentifier> INTERVAL_JOIN_CONDITIONS = new HashSet<>();
     static {
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_AFTER);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_BEFORE);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_COVERED_BY);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_COVERS);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_ENDED_BY);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_ENDS);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_MEETS);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_MET_BY);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPS);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_STARTED_BY);
-        intervalJoinConditions.add(AsterixBuiltinFunctions.INTERVAL_STARTS);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_AFTER);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_BEFORE);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_COVERED_BY);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_COVERS);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_ENDED_BY);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_ENDS);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_MEETS);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_MET_BY);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_OVERLAPS);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_STARTED_BY);
+        INTERVAL_JOIN_CONDITIONS.add(AsterixBuiltinFunctions.INTERVAL_STARTS);
     }
 
     @Override
@@ -321,7 +318,7 @@ public class IntervalSplitPartitioningRule implements IAlgebraicRewriteRule
{
         }
         // Check whether the function is a function we want to alter.
         AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
-        if (!intervalJoinConditions.contains(funcExpr.getFunctionIdentifier())) {
+        if (!INTERVAL_JOIN_CONDITIONS.contains(funcExpr.getFunctionIdentifier())) {
             return null;
         }
         ILogicalExpression funcArg = funcExpr.getArguments().get(branch).getValue();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/JoinUtils.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/JoinUtils.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/JoinUtils.java
index 14b7aa6..b991531 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/JoinUtils.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/JoinUtils.java
@@ -19,16 +19,16 @@
 package org.apache.asterix.optimizer.rules.util;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import org.apache.asterix.algebra.operators.physical.IntervalIndexJoinPOperator;
 import org.apache.asterix.algebra.operators.physical.IntervalPartitionJoinPOperator;
 import org.apache.asterix.common.annotations.IntervalJoinExpressionAnnotation;
-import org.apache.asterix.common.annotations.JoinIntervalMaxDurationExpressionAnnotation;
-import org.apache.asterix.common.annotations.JoinRecordCountsExpressionAnnotation;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.runtime.operators.joins.AfterIntervalMergeJoinCheckerFactory;
 import org.apache.asterix.runtime.operators.joins.BeforeIntervalMergeJoinCheckerFactory;
@@ -63,6 +63,30 @@ public class JoinUtils {
 
     private static final Logger LOGGER = Logger.getLogger(JoinUtils.class.getName());
 
+    private static final Map<FunctionIdentifier, FunctionIdentifier> INTERVAL_JOIN_CONDITIONS
= new HashMap<>();
+    static {
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_AFTER, AsterixBuiltinFunctions.INTERVAL_BEFORE);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_BEFORE, AsterixBuiltinFunctions.INTERVAL_AFTER);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_COVERED_BY,
+                AsterixBuiltinFunctions.INTERVAL_COVERS);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_COVERS,
+                AsterixBuiltinFunctions.INTERVAL_COVERED_BY);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_ENDED_BY, AsterixBuiltinFunctions.INTERVAL_ENDS);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_ENDS, AsterixBuiltinFunctions.INTERVAL_ENDED_BY);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_MEETS, AsterixBuiltinFunctions.INTERVAL_MET_BY);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_MET_BY, AsterixBuiltinFunctions.INTERVAL_MEETS);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY,
+                AsterixBuiltinFunctions.INTERVAL_OVERLAPS);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING,
+                AsterixBuiltinFunctions.INTERVAL_OVERLAPPING);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_OVERLAPS,
+                AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_STARTED_BY,
+                AsterixBuiltinFunctions.INTERVAL_STARTS);
+        INTERVAL_JOIN_CONDITIONS.put(AsterixBuiltinFunctions.INTERVAL_STARTS,
+                AsterixBuiltinFunctions.INTERVAL_STARTED_BY);
+    }
+
     private JoinUtils() {
     }
 
@@ -114,7 +138,6 @@ public class JoinUtils {
         return null;
     }
 
-
     private static void setSortMergeIntervalJoinOp(AbstractBinaryJoinOperator op, FunctionIdentifier
fi,
             List<LogicalVariable> sideLeft, List<LogicalVariable> sideRight,
IRangeMap rangeMap,
             IOptimizationContext context) {
@@ -126,20 +149,20 @@ public class JoinUtils {
     private static void setIntervalPartitionJoinOp(AbstractBinaryJoinOperator op, FunctionIdentifier
fi,
             List<LogicalVariable> sideLeft, List<LogicalVariable> sideRight,
IRangeMap rangeMap,
             IntervalJoinExpressionAnnotation ijea, IOptimizationContext context) {
-        long leftCount = ijea.getLeftRecordCount() > 0 ? ijea.getLeftRecordCount()
-                : getCardinality(sideLeft, context);
+        long leftCount = ijea.getLeftRecordCount() > 0 ? ijea.getLeftRecordCount() : getCardinality(sideLeft,
context);
         long rightCount = ijea.getRightRecordCount() > 0 ? ijea.getRightRecordCount()
                 : getCardinality(sideRight, context);
         long leftMaxDuration = ijea.getLeftMaxDuration() > 0 ? ijea.getLeftMaxDuration()
                 : getMaxDuration(sideLeft, context);
         long rightMaxDuration = ijea.getRightMaxDuration() > 0 ? ijea.getRightMaxDuration()
                 : getMaxDuration(sideRight, context);
+        int tuplesPerFrame = ijea.getTuplesPerFrame() > 0 ? ijea.getTuplesPerFrame()
+                : context.getPhysicalOptimizationConfig().getMaxRecordsPerFrame();
 
         IIntervalMergeJoinCheckerFactory mjcf = getIntervalMergeJoinCheckerFactory(fi, rangeMap);
         op.setPhysicalOperator(new IntervalPartitionJoinPOperator(op.getJoinKind(), JoinPartitioningType.BROADCAST,
                 sideLeft, sideRight, context.getPhysicalOptimizationConfig().getMaxFramesForJoin(),
leftCount,
-                rightCount, leftMaxDuration, rightMaxDuration,
-                context.getPhysicalOptimizationConfig().getMaxRecordsPerFrame(), mjcf, rangeMap));
+                rightCount, leftMaxDuration, rightMaxDuration, tuplesPerFrame, mjcf, rangeMap));
     }
 
     private static void setIntervalIndexJoinOp(AbstractBinaryJoinOperator op, FunctionIdentifier
fi,
@@ -235,48 +258,12 @@ public class JoinUtils {
     }
 
     private static boolean isIntervalFunction(FunctionIdentifier fi) {
-        return fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPS)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_COVERS)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_COVERED_BY)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_AFTER)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_BEFORE)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_MEETS)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_MET_BY)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_STARTS)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_STARTED_BY)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_ENDS)
-                || fi.equals(AsterixBuiltinFunctions.INTERVAL_ENDED_BY);
+        return INTERVAL_JOIN_CONDITIONS.containsKey(fi);
     }
 
     private static FunctionIdentifier reverseIntervalExpression(FunctionIdentifier fi) {
-        if (fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPS)) {
-            return AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPED_BY)) {
-            return AsterixBuiltinFunctions.INTERVAL_OVERLAPS;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_OVERLAPPING)) {
-            return AsterixBuiltinFunctions.INTERVAL_OVERLAPPING;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_COVERS)) {
-            return AsterixBuiltinFunctions.INTERVAL_COVERED_BY;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_COVERED_BY)) {
-            return AsterixBuiltinFunctions.INTERVAL_COVERS;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_STARTS)) {
-            return AsterixBuiltinFunctions.INTERVAL_STARTED_BY;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_STARTED_BY)) {
-            return AsterixBuiltinFunctions.INTERVAL_STARTS;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_ENDS)) {
-            return AsterixBuiltinFunctions.INTERVAL_ENDED_BY;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_ENDED_BY)) {
-            return AsterixBuiltinFunctions.INTERVAL_ENDS;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_AFTER)) {
-            return AsterixBuiltinFunctions.INTERVAL_BEFORE;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_BEFORE)) {
-            return AsterixBuiltinFunctions.INTERVAL_AFTER;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_MET_BY)) {
-            return AsterixBuiltinFunctions.INTERVAL_MEETS;
-        } else if (fi.equals(AsterixBuiltinFunctions.INTERVAL_MEETS)) {
-            return AsterixBuiltinFunctions.INTERVAL_MET_BY;
+        if (INTERVAL_JOIN_CONDITIONS.containsKey(fi)) {
+            return INTERVAL_JOIN_CONDITIONS.get(fi);
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.11.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.11.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.11.query.aql
index 1fe23da..7cf839d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.11.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.11.query.aql
@@ -26,7 +26,7 @@ use dataverse TinyCollege;
 
 for $f in dataset Staff
 for $d in dataset Students
-where /*+ interval-partition-join [10000,11000,12000,14000,15000] 7 7 400 400 */ interval-overlapping($d.attendance,
$f.employment)
+where /*+ interval-partition-join [10000,11000,12000,14000,15000] 7 7 400 400 300 */ interval-overlapping($d.attendance,
$f.employment)
 /*+ range ["F", "L", "R"] */
 order by $f.name, $d.name
 return { "staff" : $f.name, "student" : $d.name }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.12.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.12.query.aql
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.12.query.aql
index 2057130..aa55cec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.12.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/temporal/interval_joins/interval_overlapping/interval_overlapping.12.query.aql
@@ -26,7 +26,7 @@ use dataverse TinyCollege;
 
 for $f in dataset Staff
 for $d in dataset Students
-where /*+ interval-partition-join [10000,11000,12000,14000,15000] 7 7 400 400 */ interval-overlapping($f.employment,
$d.attendance)
+where /*+ interval-partition-join [10000,11000,12000,14000,15000] 7 7 400 400 300 */ interval-overlapping($f.employment,
$d.attendance)
 /*+ range ["F", "L", "R"] */
 order by $f.name, $d.name
 return { "staff" : $f.name, "student" : $d.name }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/IntervalJoinExpressionAnnotation.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/IntervalJoinExpressionAnnotation.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/IntervalJoinExpressionAnnotation.java
index f2f325d..7d4f02a 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/IntervalJoinExpressionAnnotation.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/IntervalJoinExpressionAnnotation.java
@@ -37,6 +37,7 @@ public class IntervalJoinExpressionAnnotation extends AbstractExpressionAnnotati
     private long rightMaxDuration = -1;
     private long leftRecordCount = -1;
     private long rightRecordCount = -1;
+    private int tuplesPerFrame = -1;
 
 
     @Override
@@ -56,11 +57,12 @@ public class IntervalJoinExpressionAnnotation extends AbstractExpressionAnnotati
         String[] args = ((String) object).split(" ");
         setJoinType(args[0]);
 
-        if (joinType.equals(PARTITION_HINT_STRING) && args.length == 6) {
+        if (joinType.equals(PARTITION_HINT_STRING) && args.length == 7) {
             leftRecordCount = Long.valueOf(args[2]);
             rightRecordCount = Long.valueOf(args[3]);
             leftMaxDuration = Long.valueOf(args[4]);
             rightMaxDuration = Long.valueOf(args[5]);
+            tuplesPerFrame = Integer.valueOf(args[6]);
         }
     }
 
@@ -94,6 +96,10 @@ public class IntervalJoinExpressionAnnotation extends AbstractExpressionAnnotati
         return rightRecordCount;
     }
 
+    public int getTuplesPerFrame() {
+        return tuplesPerFrame;
+    }
+
     public void setRangeMap(IRangeMap map) {
         this.map = map;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/22d1dbcb/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/intervalpartition/IntervalPartitionUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/intervalpartition/IntervalPartitionUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/intervalpartition/IntervalPartitionUtil.java
index c6e95e1..4752e00 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/intervalpartition/IntervalPartitionUtil.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/joins/intervalpartition/IntervalPartitionUtil.java
@@ -27,16 +27,44 @@ import java.util.Map.Entry;
 
 import org.apache.asterix.runtime.operators.joins.IIntervalMergeJoinChecker;
 import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
 import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.dataflow.common.data.partition.range.IRangeMap;
 
 public class IntervalPartitionUtil {
     public static final double C_CPU = 0.5;
-    public static final double C_IO = 10;
+    public static final double C_IO = 100;
 
     private IntervalPartitionUtil() {
     }
 
+    public static void main(String[] args) {
+
+//
+//        PhysicalOptimizationConfig poc = new PhysicalOptimizationConfig();
+//
+//        long[] countList = { poc.getMaxFramesForJoinLeftInput() };
+//        long[] maxDurationList = { poc.getMaxIntervalDuration() };
+//        int[] tuplesList = { poc.getMaxRecordsPerFrame() };
+
+        long[] countList = { 2441, 9766, 39063, 156250, 625000, 2500000, 10000000 };
+        long[] maxDurationList = { 1, 3, 30, 300, 3000, 30000, 300000 };
+        int[] tuplesList = { 5, 50, 300, 900 };
+
+
+        int k;
+        for (long count : countList) {
+            for (long maxDuration : maxDurationList) {
+                for (int tuples : tuplesList) {
+                    k = determineK(count, maxDuration, count, maxDuration, tuples);
+                    System.err.println(
+                            "size: " + count + " duration: " + maxDuration + " tuples: "
+ tuples + " k: " + k);
+                }
+            }
+        }
+
+    }
+
     public static int determineK(long countR, long maxDurationR, long countS, long maxDurationS,
int avgTuplePerFrame) {
         double deltaR = 1.0 / maxDurationR;
         double deltaS = 1.0 / maxDurationS;


Mime
View raw message