Examples of VTuple


Examples of org.apache.tajo.storage.VTuple

      return null;
    }
  }

  private Tuple makeTuple() throws IOException {
    Tuple tuple = new VTuple(schema.size());
    synchronized (lock) {
      column.resetValid(schema.size());
      int tid; // target column id
      for (int i = 0; i < projectionMap.length; i++) {
        tid = projectionMap[i];

        byte[] bytes = column.get(tid).getBytesCopy();
        Datum datum = serde.deserialize(targets[i], bytes, 0, bytes.length, nullChars);
        tuple.put(tid, datum);
      }
    }
    return tuple;
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

  @Override
  public Datum terminate(EvalContext ctx) {
    FuncCallCtx localCtx = (FuncCallCtx) ctx;
    if (this.params == null) {
      params = new VTuple(argEvals.length);
    }

    if(argEvals != null) {
      params.clear();
      for(int i=0;i < argEvals.length; i++) {
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

  @Override
  public void eval(EvalContext ctx, Schema schema, Tuple tuple) {
    AggFunctionCtx localCtx = (AggFunctionCtx) ctx;
    if (params == null) {
      this.params = new VTuple(argEvals.length);
    }

    if (argEvals != null) {
      params.clear();
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

          throw new UnsupportedOperationException();
      }
    }

    for (int p = 0; p < partNum; p++) {
      Tuple sTuple = new VTuple(schema.getColumnNum());
      Tuple eTuple = new VTuple(schema.getColumnNum());
      for (int i = 0; i < schema.getColumnNum(); i++) {
        col = schema.getColumn(i);
        sTuple.put(i, prevValues[i]);
        switch (col.getDataType().getType()) {
          case CHAR:
            char endChar = (char) (prevValues[i].asChar() + term[i].asChar());
            if (endChar > end.get(i).asByte()) {
              eTuple.put(i, end.get(i));
            } else {
              eTuple.put(i, DatumFactory.createChar(endChar));
            }
            prevValues[i] = DatumFactory.createChar(endChar);
            break;
          case BIT:
            byte endByte = (byte) (prevValues[i].asByte() + term[i].asByte());
            if (endByte > end.get(i).asByte()) {
              eTuple.put(i, end.get(i));
            } else {
              eTuple.put(i, DatumFactory.createBit(endByte));
            }
            prevValues[i] = DatumFactory.createBit(endByte);
            break;
          case INT2:
            int endShort = (short) (prevValues[i].asInt2() + term[i].asInt2());
            if (endShort > end.get(i).asInt2()) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createInt2((short) endShort));
            }
            prevValues[i] = DatumFactory.createInt2((short) endShort);
            break;
          case INT4:
            int endInt = (prevValues[i].asInt4() + term[i].asInt4());
            if (endInt > end.get(i).asInt4()) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createInt4(endInt));
            }
            prevValues[i] = DatumFactory.createInt4(endInt);
            break;

          case INT8:
            long endLong = (prevValues[i].asInt8() + term[i].asInt8());
            if (endLong > end.get(i).asInt8()) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createInt8(endLong));
            }
            prevValues[i] = DatumFactory.createInt8(endLong);
            break;

          case FLOAT4:
            float endFloat = (prevValues[i].asFloat4() + term[i].asFloat4());
            if (endFloat > end.get(i).asFloat4()) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createFloat4(endFloat));
            }
            prevValues[i] = DatumFactory.createFloat4(endFloat);
            break;
          case FLOAT8:
            double endDouble = (prevValues[i].asFloat8() + term[i].asFloat8());
            if (endDouble > end.get(i).asFloat8()) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createFloat8(endDouble));
            }
            prevValues[i] = DatumFactory.createFloat8(endDouble);
            break;
          case TEXT:
            String endString = ((char)(prevValues[i].asChars().charAt(0) + term[i].asChars().charAt(0))) + "";
            if (endString.charAt(0) > end.get(i).asChars().charAt(0)) {
              eTuple.put(i, end.get(i));
            } else {
              // TODO - to consider overflow
              eTuple.put(i, DatumFactory.createText(endString));
            }
            prevValues[i] = DatumFactory.createText(endString);
            break;
          case INET4:
            throw new UnsupportedOperationException();
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    for (Column col : target.getColumns()) {
      Preconditions.checkState(statSet.containsKey(col),
          "ERROR: Invalid Column Stats (column stats: " + colStats + ", there exists not target " + col);
    }

    Tuple startTuple = new VTuple(target.getColumnNum());
    Tuple endTuple = new VTuple(target.getColumnNum());
    int i = 0;
    for (Column col : target.getColumns()) {
      startTuple.put(i, statSet.get(col).getMinValue());
      endTuple.put(i, statSet.get(col).getMaxValue());
      i++;
    }
    return new TupleRange(target, startTuple, endTuple);
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

   *
   * @param size The number of columns of a creating tuple
   * @return The created tuple filled with NULL values
   */
  public static Tuple createNullPaddedTuple(int size){
    VTuple aTuple = new VTuple(size);
    int i;
    for(i = 0; i < size; i++){
      aTuple.put(i, DatumFactory.createNullDatum());
    }
    return aTuple;
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    }
  }

  @Override
  public Tuple next() throws IOException {
    Tuple tuple = new VTuple(schema.getColumnNum());

    if (!columns[0].hasNext()) {
      return null;
    }

    int tid; // column id of the original input schema
    for (int i = 0; i < projectionMap.length; i++) {
      tid = projectionMap[i];
      columns[i].startRow();
      DataType dataType = schema.getColumn(tid).getDataType();
      switch (dataType.getType()) {
        case BOOLEAN:
          tuple.put(tid,
              DatumFactory.createBool(((Integer)columns[i].nextValue()).byteValue()));
          break;
        case BIT:
          tuple.put(tid,
              DatumFactory.createBit(((Integer) columns[i].nextValue()).byteValue()));
          break;
        case CHAR:
          String str = (String) columns[i].nextValue();
          tuple.put(tid,
              DatumFactory.createChar(str));
          break;

        case INT2:
          tuple.put(tid,
              DatumFactory.createInt2(((Integer) columns[i].nextValue()).shortValue()));
          break;
        case INT4:
          tuple.put(tid,
              DatumFactory.createInt4((Integer) columns[i].nextValue()));
          break;

        case INT8:
          tuple.put(tid,
              DatumFactory.createInt8((Long) columns[i].nextValue()));
          break;

        case FLOAT4:
          tuple.put(tid,
              DatumFactory.createFloat4((Float) columns[i].nextValue()));
          break;

        case FLOAT8:
          tuple.put(tid,
              DatumFactory.createFloat8((Double) columns[i].nextValue()));
          break;

        case INET4:
          tuple.put(tid,
              DatumFactory.createInet4(((ByteBuffer) columns[i].nextValue()).array()));
          break;

        case TEXT:
          tuple.put(tid,
              DatumFactory.createText((String) columns[i].nextValue()));
          break;

        case PROTOBUF: {
          ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode());
          Message.Builder builder = factory.newBuilder();
          builder.mergeFrom(((ByteBuffer)columns[i].nextValue()).array());
          tuple.put(tid, factory.createDatum(builder));
          break;
        }

        case BLOB:
          tuple.put(tid,
              new BlobDatum(((ByteBuffer) columns[i].nextValue())));
          break;

        case NULL:
          tuple.put(tid, NullDatum.get());
          break;

        default:
          throw new IOException("Unsupport data type");
      }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

public class HashPartitioner extends Partitioner {
  private final Tuple keyTuple;
 
  public HashPartitioner(final int [] keys, final int numPartitions) {
    super(keys, numPartitions);
    this.keyTuple = new VTuple(partitionKeys.length);
  }
View Full Code Here

Examples of org.apache.tajo.storage.VTuple

    // for projection
    if (!inSchema.equals(outSchema)) {
      targetIds = RowStoreUtil.getTargetIds(inSchema, outSchema);
    }

    this.outputTuple = new VTuple(outSchema.getColumnNum());
  }
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());

    leftNumCols = leftChild.getSchema().getColumnNum();
    rightNumCols = rightChild.getSchema().getColumnNum();
  }
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.