Skip to content

Commit

Permalink
complete working version
Browse files Browse the repository at this point in the history
  • Loading branch information
anilshanbhag committed Oct 7, 2015
1 parent 3bd2dc0 commit 3486946
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/main/java/core/adapt/opt/Optimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@
import core.utils.TypeUtils.TYPE;

/**
*
* Optimizer creates the execution plans for the queries.
* It uses the incoming query predicates as hints for what should be added
* into the partitioning tree. If we find a plan which has benefit >
* cost, we do the repartitioning. Else we just do a scan.
* @author anil
*/

public class Optimizer {
static final int BLOCK_SIZE = 64 * 1024;
static final float DISK_MULTIPLIER = 1;
static final float NETWORK_MULTIPLIER = 1;

static final long NODE_MEM_SIZE = 1024 * 1024 * 1024 * 2;
static final int TUPLE_SIZE = 128;
static final double NODE_TUPLE_LIMIT = 33554432; // NODE_MEM_SIZE / TUPLE_SIZE
static final float WRITE_MULTIPLIER = 2;

RobustTree rt;
int rtDepth;
Expand Down Expand Up @@ -916,11 +914,7 @@ public Plans getBestPlanForSubtree(RNode node, Predicate[] ps, int pid) {

public double computeCost(RNode r) {
double numTuples = r.numTuplesInSubtree();
if (numTuples > NODE_TUPLE_LIMIT) {
return (DISK_MULTIPLIER + NETWORK_MULTIPLIER) * numTuples;
} else {
return DISK_MULTIPLIER * numTuples;
}
return WRITE_MULTIPLIER * numTuples;
}

public static int getDepthOfIndex(int numBlocks) {
Expand Down

0 comments on commit 3486946

Please sign in to comment.