Examples of SelectionVectorMode


Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

public class VectorValidator {
  public static void validate(RecordBatch batch) {
    int count = batch.getRecordCount();
    long hash = 12345;
    SelectionVectorMode mode = batch.getSchema().getSelectionVectorMode();
    switch(mode) {
      case NONE: {
        for (VectorWrapper w : batch) {
          ValueVector v = w.getValueVector();
          for (int i = 0; i < count; i++) {
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

        vectorIndex++;
        bufferOffset += fmd.getBufferLength();
      }
    }

    SelectionVectorMode svMode;
    if (def.hasCarriesTwoByteSelectionVector() && def.getCarriesTwoByteSelectionVector()) {
      svMode = SelectionVectorMode.TWO_BYTE;
    } else {
      svMode = SelectionVectorMode.NONE;
    }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    container.setRecordCount(recordCount);
    container.buildSchema(batch.getSchema().getSelectionVectorMode());
  }

  public void canonicalize() {
    SelectionVectorMode mode = container.getSchema().getSelectionVectorMode();
    container = VectorContainer.canonicalize(container);
    container.buildSchema(mode);
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    return SelectionVectorMode.ALL;
  }

  @Override
  public SelectionVectorMode getEncoding() {
    SelectionVectorMode m = ((Prel) this.getChild()).getEncoding();
    if(m == SelectionVectorMode.FOUR_BYTE) return SelectionVectorMode.FOUR_BYTE;
    return SelectionVectorMode.TWO_BYTE;
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

  public static PlannerSettings getPlannerSettings(RelOptPlanner planner) {
    return planner.getContext().unwrap(PlannerSettings.class);
  }

  public static Prel removeSvIfRequired(Prel prel, SelectionVectorMode... allowed){
    SelectionVectorMode current = prel.getEncoding();
    for(SelectionVectorMode m : allowed){
      if(current == m) return prel;
    }
    return new SelectionVectorRemoverPrel(prel);
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    for (OutgoingRecordBatch outgoingRecordBatch : outgoingBatches) {
      outgoingRecordBatch.initializeBatch();
    }

    SelectionVectorMode svMode = incoming.getSchema().getSelectionVectorMode();
    switch(svMode){
      case FOUR_BYTE:
        this.sv4 = incoming.getSelectionVector4();
        break;

      case TWO_BYTE:
        this.sv2 = incoming.getSelectionVector2();
        break;

      case NONE:
        break;

      default:
        throw new UnsupportedOperationException("Unknown selection vector mode: " + svMode.toString());
    }
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    }
  }

  @Override
  public void partitionBatch(RecordBatch incoming) throws IOException {
    SelectionVectorMode svMode = incoming.getSchema().getSelectionVectorMode();

    // Keeping the for loop inside the case to avoid case evaluation for each record.
    switch(svMode) {
      case NONE:
        for (int recordId = 0; recordId < incoming.getRecordCount(); ++recordId) {
          OutgoingRecordBatch outgoingBatch = outgoingBatches.get(doEval(recordId));
          if (!outgoingBatch.copy(recordId)) {
            logger.trace(REWRITE_MSG, recordId);
            outgoingBatch.flush();
            if (!outgoingBatch.copy(recordId)) {
              logger.debug(RECORD_TOO_BIG_MSG, recordId);
              throw new IOException(RECORD_TOO_BIG_MSG);
            }
          }
        }
        break;

      case TWO_BYTE:
        for (int recordId = 0; recordId < incoming.getRecordCount(); ++recordId) {
          int svIndex = sv2.getIndex(recordId);
          OutgoingRecordBatch outgoingBatch = outgoingBatches.get(doEval(svIndex));
          if (!outgoingBatch.copy(svIndex)) {
            logger.trace(REWRITE_MSG, svIndex);
            outgoingBatch.flush();
            if (!outgoingBatch.copy(svIndex)) {
              logger.debug(RECORD_TOO_BIG_MSG, recordId);
              throw new IOException(RECORD_TOO_BIG_MSG);
            }
          }
        }
        break;

      case FOUR_BYTE:
        for (int recordId = 0; recordId < incoming.getRecordCount(); ++recordId) {
          int svIndex = sv4.get(recordId);
          OutgoingRecordBatch outgoingBatch = outgoingBatches.get(doEval(svIndex));
          if (!outgoingBatch.copy(svIndex)) {
            logger.trace(REWRITE_MSG, svIndex);
            outgoingBatch.flush();
            if (!outgoingBatch.copy(svIndex)) {
              logger.debug(RECORD_TOO_BIG_MSG, recordId);
              throw new IOException(RECORD_TOO_BIG_MSG);
            }
          }
        }
        break;

      default:
        throw new UnsupportedOperationException("Unknown selection vector mode: " + svMode.toString());
    }
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    container.setRecordCount(recordCount);
    container.buildSchema(batch.getSchema().getSelectionVectorMode());
  }

  public void canonicalize() {
    SelectionVectorMode mode = container.getSchema().getSelectionVectorMode();
    container = VectorContainer.canonicalize(container);
    container.buildSchema(mode);
  }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

  public static PlannerSettings getPlannerSettings(RelOptPlanner planner) {
    return planner.getContext().unwrap(PlannerSettings.class);
  }

  public static Prel removeSvIfRequired(Prel prel, SelectionVectorMode... allowed) {
    SelectionVectorMode current = prel.getEncoding();
    for (SelectionVectorMode m : allowed) {
      if (current == m) {
        return prel;
      }
    }
View Full Code Here

Examples of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

    for (OutgoingRecordBatch outgoingRecordBatch : outgoingBatches) {
      outgoingRecordBatch.initializeBatch();
    }

    SelectionVectorMode svMode = incoming.getSchema().getSelectionVectorMode();
    switch(svMode){
      case FOUR_BYTE:
        this.sv4 = incoming.getSelectionVector4();
        break;

      case TWO_BYTE:
        this.sv2 = incoming.getSelectionVector2();
        break;

      case NONE:
        break;

      default:
        throw new UnsupportedOperationException("Unknown selection vector mode: " + svMode.toString());
    }
  }
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.