paul-rogers commented on code in PR #12909:
URL: https://github.com/apache/druid/pull/12909#discussion_r949358623
##########
sql/src/main/java/org/apache/druid/sql/DirectStatement.java:
##########
@@ -62,8 +65,81 @@ public class DirectStatement extends AbstractStatement
implements Cancelable
{
private static final Logger log = new Logger(DirectStatement.class);
+ /**
+ * Represents the execution plan for a query with the ability to run
+ * that plan (once).
+ */
+ public class ResultSet implements Cancelable
Review Comment:
The name echos the JDBC concept of a result set. It is a way to get results
for a statement. The idea, in JDBC, is that rather than the statement having
two "modes" (running or not), the lifecycle is encoded in the class structure.
A statement does the work of everything up to a set of results; the result set
then manages those results. As in JDBC, some operations are common (close, etc.)
This is needed because of a use case (outside of Druid itself) where we want
to manage the results in a different thread than the one that prepares the
statement. Splitting out the functionality to a `ResultSet` is a bit cleaner
than having "is prepared and ready to run" state in the statement itself.
This is a quick & dirty refactoring to solve issues created by the previous
PR. As you point out, it could be improved after we give it a bit more thought.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]