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

Add comments to async query handlers #2657

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import org.opensearch.sql.spark.leasemanager.model.LeaseRequest;
import org.opensearch.sql.spark.response.JobExecutionResponseReader;

/**
* The handler for batch query. With batch query, queries are executed as single batch. The queries
* are sent along with job execution request ({@link StartJobRequest}) to spark.
*/
@RequiredArgsConstructor
public class BatchQueryHandler extends AsyncQueryHandler {
private final EMRServerlessClient emrServerlessClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
import org.opensearch.sql.spark.flint.operation.FlintIndexOpFactory;
import org.opensearch.sql.spark.response.JobExecutionResponseReader;

/** Handle Index DML query. includes * DROP * ALT? */
/**
* The handler for Index DML (Data Manipulation Language) query. Handles DROP/ALTER/VACUUM operation
* for flint indices. It will stop streaming query job as needed (e.g. when the flint index is
* automatically updated by a streaming query, the streaming query is stopped when the index is
* dropped)
*/
@RequiredArgsConstructor
public class IndexDMLHandler extends AsyncQueryHandler {
private static final Logger LOG = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
import org.opensearch.sql.spark.leasemanager.model.LeaseRequest;
import org.opensearch.sql.spark.response.JobExecutionResponseReader;

/**
* The handler for interactive query. With interactive query, a session will be first established
* and then the session will be reused for the following queries(statements). Session is an
* abstraction of spark job, and once the job is started, the job will continuously poll the
* statements and execute query specified in it.
*/
@RequiredArgsConstructor
public class InteractiveQueryHandler extends AsyncQueryHandler {
private final SessionManager sessionManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import org.opensearch.sql.spark.leasemanager.LeaseManager;
import org.opensearch.sql.spark.response.JobExecutionResponseReader;

/** Handle Refresh Query. */
/**
* The handler for refresh query. Refresh query is one time query request to refresh(update) flint
* index, and new job is submitted to Spark.
*/
public class RefreshQueryHandler extends BatchQueryHandler {

private final FlintIndexMetadataService flintIndexMetadataService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
import org.opensearch.sql.spark.leasemanager.model.LeaseRequest;
import org.opensearch.sql.spark.response.JobExecutionResponseReader;

/** Handle Streaming Query. */
/**
* The handler for streaming query. Streaming query is a job to continuously update flint index.
* Once started, the job can be stopped by IndexDML query.
*/
public class StreamingQueryHandler extends BatchQueryHandler {
private final EMRServerlessClient emrServerlessClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

import org.opensearch.sql.spark.dispatcher.model.IndexDMLResult;

/**
* Abstraction over the IndexDMLResult storage. It stores the result of IndexDML query execution.
*/
public interface IndexDMLResultStorageService {
IndexDMLResult createIndexDMLResult(IndexDMLResult result, String datasourceName);
}
Loading