Examples of VTuple


Examples of org.apache.tajo.storage.VTuple

  protected void loadRightToHashTable() throws IOException {
    Tuple tuple;
    Tuple keyTuple;

    while ((tuple = rightChild.next()) != null) {
      keyTuple = new VTuple(joinKeyPairs.size());
      List<Tuple> newValue;
      for (int i = 0; i < rightKeyList.length; i++) {
        keyTuple.put(i, tuple.get(rightKeyList[i]));
      }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

      if (incs[i] == null) {
        incs[i] = new BigDecimal(0);
      }
    }

    Tuple end = new VTuple(schema.getColumnNum());
    Column column;
    for (int i = 0; i < last.size(); i++) {
      column = schema.getColumn(i);
      switch (column.getDataType().getType()) {
        case CHAR:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue())));
          }
          break;
        case BIT:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createBit(
                (byte) (range.getStart().get(i).asByte() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue())));
          }
          break;
        case INT2:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt2(
                (short) (range.getStart().get(i).asInt2() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue())));
          }
          break;
        case INT4:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt4(
                (int) (range.getStart().get(i).asInt4() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue())));
          }
          break;
        case INT8:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt8(
                range.getStart().get(i).asInt4() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue()));
          }
          break;
        case FLOAT4:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createFloat4(
                range.getStart().get(i).asFloat4() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue()));
          }
          break;
        case FLOAT8:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createFloat8(
                range.getStart().get(i).asFloat8() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue()));
          }
          break;
        case TEXT:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0)
                + incs[i].longValue())) + ""));
          } else {
            end.put(i, DatumFactory.createText(
                ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + ""));
          }
          break;
        default:
          throw new UnsupportedOperationException(column.getDataType() + " is not supported yet");
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    this.projector = new Projector(inSchema, outSchema, plan.getTargets());
    this.evalContexts = projector.renew();

    // for join
    frameTuple = new FrameTuple();
    outTuple = new VTuple(outSchema.getColumnNum());
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

  * @see PhysicalExec#next()
  */
  @Override
  public Tuple next() throws IOException {   
    Target [] targets = plan.getExprs();
    Tuple t = new VTuple(targets.length);
    for (int i = 0; i < targets.length; i++) {
      targets[i].getEvalTree().eval(evalContexts[i], inSchema, null);
      t.put(i, targets[i].getEvalTree().terminate(evalContexts[i]));
    }
    return t;
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    Tuple curKey;
    Tuple tuple;
    Tuple finalTuple = null;
    while(!context.isStopped() && (tuple = child.next()) != null) {
      // build a key tuple
      curKey = new VTuple(keylist.length);
      for(int i = 0; i < keylist.length; i++) {
        curKey.put(i, tuple.get(keylist[i]));
      }

      if (prevKey == null || prevKey.equals(curKey)) {
        if (prevKey == null) {
          for(int i = 0; i < outSchema.getColumnNum(); i++) {
            evalContexts[i] = evals[i].newContext();
            evals[i].eval(evalContexts[i], inSchema, tuple);
          }
          prevKey = curKey;
        } else {
          // aggregate
          for (int idx : measureList) {
            evals[idx].eval(evalContexts[idx], inSchema, tuple);
          }
        }
      } else {
        // finalize aggregate and return
        finalTuple = new VTuple(outSchema.getColumnNum());
        for(int i = 0; i < outSchema.getColumnNum(); i++) {
          finalTuple.put(i, evals[i].terminate(evalContexts[i]));
        }

        for(int i = 0; i < outSchema.getColumnNum(); i++) {
          evalContexts[i] = evals[i].newContext();
          evals[i].eval(evalContexts[i], inSchema, tuple);
        }
        prevKey = curKey;
        return finalTuple;
      }
    } // while loop

    if (!finished) {
      finalTuple = new VTuple(outSchema.getColumnNum());
      for(int i = 0; i < outSchema.getColumnNum(); i++) {
        finalTuple.put(i, evals[i].terminate(evalContexts[i]));
      }
      finished = true;
    }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    this.projector = new Projector(inSchema, outSchema, plan.getTargets());
    this.evalContexts = projector.renew();

    // for join
    frameTuple = new FrameTuple();
    outTuple = new VTuple(outSchema.getColumnNum());
    leftKeyTuple = new VTuple(leftKeyList.length);
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

  protected void loadRightToHashTable() throws IOException {
    Tuple tuple;
    Tuple keyTuple;

    while ((tuple = rightChild.next()) != null) {
      keyTuple = new VTuple(joinKeyPairs.size());
      List<Tuple> newValue;
      for (int i = 0; i < rightKeyList.length; i++) {
        keyTuple.put(i, tuple.get(rightKeyList[i]));
      }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    evalContexts = projector.renew();

    // for join
    needNextRightTuple = true;
    frameTuple = new FrameTuple();
    outTuple = new VTuple(outSchema.getColumnNum());

    foundAtLeastOneMatch = false;
    rightNumCols = rightChild.getSchema().getColumnNum();
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    evalContexts = projector.renew();

    // for join
    needNewOuter = true;
    frameTuple = new FrameTuple();
    outTuple = new VTuple(outSchema.getColumnNum());
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

  }

  public void init() throws IOException {
    super.init();

    this.outTuple = new VTuple(outSchema.getColumnNum());
    this.projector = new Projector(inSchema, outSchema, this.plan.getTargets());
    this.evalContexts = projector.renew();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.