congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Driver.getDriverContext
Code IndexAdd Tabnine to your IDE (free)

How to use
getDriverContext
method
in
com.facebook.presto.operator.Driver

Best Java code snippets using com.facebook.presto.operator.Driver.getDriverContext (Showing top 20 results out of 315)

origin: prestodb/presto

public synchronized DriverContext getDriverContext()
{
  if (driver == null) {
    return null;
  }
  return driver.getDriverContext();
}
origin: prestodb/presto

private static boolean isOperatorBlocked(List<Driver> drivers, Predicate<OperatorContext> reason)
{
  for (Driver driver : drivers) {
    for (OperatorContext operatorContext : driver.getDriverContext().getOperatorContexts()) {
      if (reason.apply(operatorContext)) {
        return true;
      }
    }
  }
  return false;
}
origin: prestodb/presto

private static void processRow(final Driver joinDriver, final TaskStateMachine taskStateMachine)
{
  joinDriver.getDriverContext().getYieldSignal().setWithDelay(TimeUnit.SECONDS.toNanos(1), joinDriver.getDriverContext().getYieldExecutor());
  joinDriver.process();
  joinDriver.getDriverContext().getYieldSignal().reset();
  checkErrors(taskStateMachine);
}
origin: prestodb/presto

for (Driver driver : drivers) {
  if (alwaysRevokeMemory) {
    driver.getDriverContext().getOperatorContexts().stream()
        .filter(operatorContext -> operatorContext.getOperatorStats().getRevocableMemoryReservation().getValue() > 0)
        .forEach(OperatorContext::requestMemoryRevoking);
origin: prestodb/presto

/**
 * Runs Driver in another thread until it is finished
 */
private static void runDriverInThread(ExecutorService executor, Driver driver)
{
  executor.execute(() -> {
    if (!driver.isFinished()) {
      try {
        driver.process();
      }
      catch (PrestoException e) {
        driver.getDriverContext().failed(e);
        throw e;
      }
      runDriverInThread(executor, driver);
    }
  });
}
origin: prestodb/presto

/**
 * Runs Driver in another thread until it is finished
 */
private static void runDriverInThread(ExecutorService executor, Driver driver)
{
  executor.execute(() -> {
    if (!driver.isFinished()) {
      try {
        driver.process();
      }
      catch (PrestoException e) {
        driver.getDriverContext().failed(e);
        throw e;
      }
      runDriverInThread(executor, driver);
    }
  });
}
origin: prestodb/presto

@Test
public void testBrokenOperatorCloseWhileProcessing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), false);
  final Driver driver = Driver.createDriver(driverContext, brokenOperator, createSinkOperator(ImmutableList.of()));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator processing
  Future<Boolean> driverProcessFor = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
    {
      return driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone();
    }
  });
  brokenOperator.waitForLocked();
  driver.close();
  assertTrue(driver.isFinished());
  try {
    driverProcessFor.get(1, TimeUnit.SECONDS);
    fail("Expected InterruptedException");
  }
  catch (ExecutionException e) {
    assertDriverInterrupted(e.getCause());
  }
}
origin: prestodb/presto

@Test
public void testBrokenOperatorProcessWhileClosing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), true);
  final Driver driver = Driver.createDriver(driverContext, brokenOperator, createSinkOperator(ImmutableList.of()));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator close
  Future<Boolean> driverClose = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
    {
      driver.close();
      return true;
    }
  });
  brokenOperator.waitForLocked();
  assertTrue(driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone());
  assertTrue(driver.isFinished());
  brokenOperator.unlock();
  assertTrue(driverClose.get());
}
origin: prestodb/presto

@Test
public void testNormalFinish()
{
  List<Type> types = ImmutableList.of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  Operator sink = createSinkOperator(types);
  Driver driver = Driver.createDriver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  ListenableFuture<?> blocked = driver.processFor(new Duration(1, TimeUnit.SECONDS));
  assertTrue(blocked.isDone());
  assertTrue(driver.isFinished());
  assertTrue(sink.isFinished());
  assertTrue(source.isFinished());
}
origin: prestodb/presto

@Test
public void testAbruptFinish()
{
  List<Type> types = ImmutableList.of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  PageConsumerOperator sink = createSinkOperator(types);
  Driver driver = Driver.createDriver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  driver.close();
  assertTrue(driver.isFinished());
  // finish is only called in normal operations
  assertFalse(source.isFinished());
  assertFalse(sink.isFinished());
  // close is always called (values operator doesn't have a closed state)
  assertTrue(sink.isClosed());
}
origin: prestodb/presto

Driver driver = Driver.createDriver(driverContext, source, sink);
assertSame(driver.getDriverContext(), driverContext);
origin: prestodb/presto

brokenOperator.waitForLocked();
assertSame(driver.getDriverContext(), driverContext);
origin: prestodb/presto

PageConsumerOperator sink = createSinkOperator(types);
Driver driver = Driver.createDriver(driverContext, source, sink);
assertSame(driver.getDriverContext(), driverContext);
assertFalse(driver.isFinished());
Split testSplit = new Split(new ConnectorId("test"), TestingTransactionHandle.create(), new TestSplit());
origin: uk.co.nichesolutions.presto/presto-main

public synchronized DriverContext getDriverContext()
{
  if (driver == null) {
    return null;
  }
  return driver.getDriverContext();
}
origin: com.facebook.presto/presto-geospatial

/**
 * Runs Driver in another thread until it is finished
 */
private static void runDriverInThread(ExecutorService executor, Driver driver)
{
  executor.execute(() -> {
    if (!driver.isFinished()) {
      try {
        driver.process();
      }
      catch (PrestoException e) {
        driver.getDriverContext().failed(e);
        throw e;
      }
      runDriverInThread(executor, driver);
    }
  });
}
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testBrokenOperatorCloseWhileProcessing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), false);
  final Driver driver = new Driver(driverContext, brokenOperator, createSinkOperator(brokenOperator));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator processing
  Future<Boolean> driverProcessFor = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
        throws Exception
    {
      return driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone();
    }
  });
  brokenOperator.waitForLocked();
  driver.close();
  assertTrue(driver.isFinished());
  try {
    driverProcessFor.get(1, TimeUnit.SECONDS);
    fail("Expected InterruptedException");
  }
  catch (ExecutionException e) {
    checkArgument(getRootCause(e) instanceof InterruptedException, "Expected root cause exception to be an instance of InterruptedException");
  }
}
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testBrokenOperatorProcessWhileClosing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), true);
  final Driver driver = new Driver(driverContext, brokenOperator, createSinkOperator(brokenOperator));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator close
  Future<Boolean> driverClose = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
        throws Exception
    {
      driver.close();
      return true;
    }
  });
  brokenOperator.waitForLocked();
  assertTrue(driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone());
  assertTrue(driver.isFinished());
  brokenOperator.unlock();
  assertTrue(driverClose.get());
}
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testAbruptFinish()
{
  List<Type> types = ImmutableList.<Type>of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), types, rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  MaterializingOperator sink = createSinkOperator(source);
  Driver driver = new Driver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  driver.close();
  assertTrue(driver.isFinished());
  // finish is only called in normal operations
  assertFalse(source.isFinished());
  assertFalse(sink.isFinished());
  // close is always called (values operator doesn't have a closed state)
  assertTrue(sink.isClosed());
}
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testNormalFinish()
{
  List<Type> types = ImmutableList.<Type>of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), types, rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  MaterializingOperator sink = createSinkOperator(source);
  Driver driver = new Driver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  ListenableFuture<?> blocked = driver.processFor(new Duration(1, TimeUnit.SECONDS));
  assertTrue(blocked.isDone());
  assertTrue(driver.isFinished());
  assertTrue(sink.isFinished());
  assertTrue(source.isFinished());
}
origin: uk.co.nichesolutions.presto/presto-main

Driver driver = new Driver(driverContext, source, sink);
assertSame(driver.getDriverContext(), driverContext);
com.facebook.presto.operatorDrivergetDriverContext

Popular methods of Driver

  • isFinished
  • process
  • close
  • processFor
  • updateSource
  • <init>
  • addSuppressedException
  • checkLockHeld
  • checkLockNotHeld
  • createDriver
  • firstFinishedFuture
  • isFinishedInternal
  • firstFinishedFuture,
  • isFinishedInternal,
  • processInternal,
  • processNewSources,
  • checkOperatorFinishedRevoking,
  • closeAndDestroyOperators,
  • createTimer,
  • destroyIfNecessary,
  • getBlockedFuture

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • requestLocationUpdates (LocationManager)
  • String (java.lang)
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JFrame (javax.swing)
  • JPanel (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now