Examples of DrillbitContext


Examples of org.apache.drill.exec.server.DrillbitContext

    List<ValueVector> vectorList = Lists.newArrayList();
    RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
    DrillConfig config = DrillConfig.create();
    Drillbit bit = new Drillbit(config, serviceSet);
    bit.run();
    DrillbitContext context = bit.getContext();

    MaterializedField intField = MaterializedField.create(new SchemaPath("int", ExpressionPosition.UNKNOWN), Types.required(TypeProtos.MinorType.INT));
    IntVector intVector = (IntVector)TypeHelper.getNewVector(intField, context.getAllocator());
    MaterializedField binField = MaterializedField.create(new SchemaPath("binary", ExpressionPosition.UNKNOWN), Types.required(TypeProtos.MinorType.VARBINARY));
    VarBinaryVector binVector = (VarBinaryVector)TypeHelper.getNewVector(binField, context.getAllocator());
    AllocationHelper.allocate(intVector, 4, 4);
    AllocationHelper.allocate(binVector, 4, 5);
    vectorList.add(intVector);
    vectorList.add(binVector);

    intVector.getMutator().setSafe(0, 0); binVector.getMutator().setSafe(0, "ZERO".getBytes());
    intVector.getMutator().setSafe(1, 1); binVector.getMutator().setSafe(1, "ONE".getBytes());
    intVector.getMutator().setSafe(2, 2); binVector.getMutator().setSafe(2, "TWO".getBytes());
    intVector.getMutator().setSafe(3, 3); binVector.getMutator().setSafe(3, "THREE".getBytes());
    intVector.getMutator().setValueCount(4);
    binVector.getMutator().setValueCount(4);

    VectorContainer container = new VectorContainer();
    container.addCollection(vectorList);
    container.setRecordCount(4);
    WritableBatch batch = WritableBatch.getBatchNoHVWrap(container.getRecordCount(), container, false);
    VectorAccessibleSerializable wrap = new VectorAccessibleSerializable(batch, context.getAllocator());

    Configuration conf = new Configuration();
    conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
    FileSystem fs = FileSystem.get(conf);
    Path path = new Path("/tmp/drillSerializable");
    if (fs.exists(path)) {
      fs.delete(path, false);
    }
    FSDataOutputStream out = fs.create(path);

    wrap.writeToStream(out);
    out.close();

    FSDataInputStream in = fs.open(path);
    VectorAccessibleSerializable newWrap = new VectorAccessibleSerializable(context.getAllocator());
    newWrap.readFromStream(in);
    fs.close();

    VectorAccessible newContainer = newWrap.get();
    for (VectorWrapper w : newContainer) {
View Full Code Here

Examples of org.apache.drill.exec.server.DrillbitContext

    this.dataHandler = new DataResponseHandlerImpl(bee);
  }

  public void start(DrillbitEndpoint endpoint, Controller controller,
      DataConnectionCreator data, ClusterCoordinator coord, PStoreProvider provider) {
    this.dContext = new DrillbitContext(endpoint, bContext, coord, controller, data, workBus, provider);
    // executor = Executors.newFixedThreadPool(dContext.getConfig().getInt(ExecConstants.EXECUTOR_THREADS)
    executor = Executors.newCachedThreadPool(new NamedThreadFactory("WorkManager-"));
    eventThread.start();
    dContext.getMetrics().register(
        MetricRegistry.name("drill.exec.work.running_fragments." + dContext.getEndpoint().getUserPort()),
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.