Package org.apache.drill.exec.record.BatchSchema

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)) {
              String msg = composeTooBigMsg(recordId, incoming);
              logger.debug(msg);
              throw new IOException(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)) {
              String msg = composeTooBigMsg(recordId, incoming);
              logger.debug(msg);
              throw new IOException(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)) {
              String msg = composeTooBigMsg(recordId, incoming);
              logger.debug(msg);
              throw new IOException(msg);
            }
          }
        }
        break;

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


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

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

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

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

TOP

Related Classes of org.apache.drill.exec.record.BatchSchema.SelectionVectorMode

Copyright © 2018 www.massapicom. 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.