Search in sources :

Example 1 with IAction

use of org.apache.asterix.experiment.action.base.IAction in project asterixdb by apache.

the class AbstractSpatialIndexExperiment3SIdxCreateAndQueryBuilder method getSelectQuery.

private SequentialActionList getSelectQuery(boolean isIndexOnlyPlan) throws IOException {
    //prepare radius and center point
    int skipLineCount = SKIP_LINE_COUNT;
    int lineCount = 0;
    String line = null;
    ;
    querySeed += SKIP_LINE_COUNT;
    if (querySeed > MAX_QUERY_SEED) {
        querySeed -= MAX_QUERY_SEED;
    }
    while (lineCount < skipLineCount) {
        if ((line = br.readLine()) == null) {
            //reopen file
            br.close();
            br = new BufferedReader(new FileReader(querySeedFilePath));
            line = br.readLine();
        }
        lineCount++;
    }
    int beginIdx = line.indexOf("(", line.indexOf("point"));
    int endIdx = line.indexOf(")", line.indexOf("point")) + 1;
    String point = line.substring(beginIdx, endIdx);
    //create action
    SequentialActionList sAction = new SequentialActionList();
    IAction queryAction = new TimedAction(new RunAQLStringAction(httpClient, restHost, restPort, getSelectQueryAQL(radiusType[radiusIter++ % radiusType.length], point, isIndexOnlyPlan), outputFos), outputFos);
    sAction.add(queryAction);
    return sAction;
}
Also used : RunAQLStringAction(org.apache.asterix.experiment.action.derived.RunAQLStringAction) IAction(org.apache.asterix.experiment.action.base.IAction) SequentialActionList(org.apache.asterix.experiment.action.base.SequentialActionList) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) TimedAction(org.apache.asterix.experiment.action.derived.TimedAction)

Example 2 with IAction

use of org.apache.asterix.experiment.action.base.IAction in project asterixdb by apache.

the class AbstractSpatialIndexExperiment3SIdxCreateAndQueryBuilder method getJoinQuery.

private SequentialActionList getJoinQuery(boolean isIndexOnlyPlan) {
    querySeed += SKIP_LINE_COUNT;
    if (querySeed > MAX_QUERY_SEED) {
        querySeed -= MAX_QUERY_SEED;
    }
    int lowId = querySeed * 10000 + 1;
    int highId = (querySeed + JOIN_CANDIDATE_COUNT) * 10000 + 1;
    //create action
    SequentialActionList sAction = new SequentialActionList();
    IAction queryAction = new TimedAction(new RunAQLStringAction(httpClient, restHost, restPort, getJoinQueryAQL(radiusType[radiusIter++ % (radiusType.length - 1)], lowId, highId, isIndexOnlyPlan), outputFos), outputFos);
    sAction.add(queryAction);
    return sAction;
}
Also used : RunAQLStringAction(org.apache.asterix.experiment.action.derived.RunAQLStringAction) IAction(org.apache.asterix.experiment.action.base.IAction) SequentialActionList(org.apache.asterix.experiment.action.base.SequentialActionList) TimedAction(org.apache.asterix.experiment.action.derived.TimedAction)

Aggregations

IAction (org.apache.asterix.experiment.action.base.IAction)2 SequentialActionList (org.apache.asterix.experiment.action.base.SequentialActionList)2 RunAQLStringAction (org.apache.asterix.experiment.action.derived.RunAQLStringAction)2 TimedAction (org.apache.asterix.experiment.action.derived.TimedAction)2 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1