Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose execution plans from the ksql engine API #3482

Merged
merged 2 commits into from
Nov 20, 2019

Conversation

rodesai
Copy link
Contributor

@rodesai rodesai commented Oct 5, 2019

Description

This patch adds interfaces to build and execute plans in the KSQL engine
API, and changes StatementExecutor to use these interfaces to run statements.
It also exposes a method executeQuery that the query endpoint can use to build
transient queries.

@rodesai rodesai requested a review from a team as a code owner October 5, 2019 00:04
@@ -88,6 +92,34 @@
*/
PreparedStatement<?> prepare(ParsedStatement stmt);

/**
* Executes a query using the engine's primary service context.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this comment indicate that this is executing it using a supplied service context? Also, should there be another method for the primary service context?
TransientQueryMetadata executeQuery( ConfiguredStatement<Query> statement );

Copy link
Contributor Author

@rodesai rodesai Oct 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this comment indicate that this is executing it using a supplied service context?

good catch

should there be another method for the primary service context?

I don't want to add it until there's something to use it.

@rodesai rodesai force-pushed the add-engine-interface-rebase branch 2 times, most recently from 858823e to 28d810b Compare October 9, 2019 07:20
Copy link
Member

@stevenpyzhang stevenpyzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posting some initial minor comments on formatting, still making my way through though.

/**
* Executes a query using the supplied service context.
*/
TransientQueryMetadata executeQuery(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
TransientQueryMetadata executeQuery(
TransientQueryMetadata executeTransientQuery(

Since this is explicitly returning a TransientQueryMetadata object, it'd be nice to have the function name indicate that. The function naming would be fine if the return type is changed to QueryMetadata.

@Override
public ExecuteResult execute(final ConfiguredStatement<?> statement) {
return execute(
ConfiguredKsqlPlan.of(plan(statement), statement.getOverrides(), statement.getConfig()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could the creation of the ConfiguredKsqlPlan be formatted similar to the execute function below in terms of the indentations.

@Override
public KsqlPlan plan(
final ServiceContext serviceContext,
final ConfiguredStatement<?> statement) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
) { should be on next line

/**
* Executes a KSQL plan using the engine's primary service context.
*/
ExecuteResult execute(ConfiguredKsqlPlan plan);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started to remove thie primary service context from this class to avoid the execute without it. I think you should remove this method in this PR.

/**
* Computes a plan for executing a DDL/DML statement using the engine's primary service context.
*/
KsqlPlan plan(ConfiguredStatement<?> statement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started to remove thie primary service context from this class to avoid the execute without it. I think you should remove this method in this PR.

@rodesai rodesai force-pushed the add-engine-interface-rebase branch 2 times, most recently from 3a7f98a to 9adace9 Compare November 19, 2019 20:33
This patch adds interfaces to build and execute plans in the KSQL engine
API, and changes StatementExecutor to use these interfaces to run statements.
It also exposes a method executeQuery that the query endpoint can use to build
transient queries.
@rodesai
Copy link
Contributor Author

rodesai commented Nov 20, 2019

@stevenpyzhang @spena can I get another look at this old PR?

Copy link
Member

@stevenpyzhang stevenpyzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, there's still that one naming nit but don't feel too strongly about it.

@rodesai rodesai merged commit 067139c into confluentinc:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants