@Override public MaterializedResult execute(Session session, @Language("SQL") String sql) { lock.readLock().lock(); try { MaterializedOutputFactory outputFactory = new MaterializedOutputFactory(); TaskContext taskContext = createTaskContext(executor, session); List<Driver> drivers = createDrivers(session, sql, outputFactory, taskContext); boolean done = false; while (!done) { boolean processed = false; for (Driver driver : drivers) { if (!driver.isFinished()) { driver.process(); processed = true; } } done = !processed; } return outputFactory.getMaterializingOperator().getMaterializedResult(); } finally { lock.readLock().unlock(); } }
public MaterializedResult execute(@Language("SQL") String sql) { MaterializedOutputFactory outputFactory = new MaterializedOutputFactory(); List<Driver> drivers = createDrivers(sql, outputFactory); boolean done = false; while (!done) { boolean processed = false; for (Driver driver : drivers) { if (!driver.isFinished()) { driver.process(); processed = true; } } done = !processed; } return outputFactory.getMaterializingOperator().getMaterializedResult(); }