-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor SparkQueryDispatcher (#2636)
* Refactor SparkQueryDispatcher Signed-off-by: Tomoyuki Morita <[email protected]> * Remove EMRServerlessClientFactory from SparkQueryDispatcher Signed-off-by: Tomoyuki Morita <[email protected]> * Fix unit test failures in SparkQueryDispatcherTest Signed-off-by: Tomoyuki Morita <[email protected]> --------- Signed-off-by: Tomoyuki Morita <[email protected]> (cherry picked from commit d32cf94) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
294566f
commit f40e94a
Showing
5 changed files
with
189 additions
and
112 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
spark/src/main/java/org/opensearch/sql/spark/dispatcher/QueryHandlerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.dispatcher; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.opensearch.client.Client; | ||
import org.opensearch.sql.spark.client.EMRServerlessClientFactory; | ||
import org.opensearch.sql.spark.execution.session.SessionManager; | ||
import org.opensearch.sql.spark.execution.statestore.StateStore; | ||
import org.opensearch.sql.spark.flint.FlintIndexMetadataService; | ||
import org.opensearch.sql.spark.leasemanager.LeaseManager; | ||
import org.opensearch.sql.spark.response.JobExecutionResponseReader; | ||
|
||
@RequiredArgsConstructor | ||
public class QueryHandlerFactory { | ||
|
||
private final JobExecutionResponseReader jobExecutionResponseReader; | ||
private final FlintIndexMetadataService flintIndexMetadataService; | ||
private final Client client; | ||
private final SessionManager sessionManager; | ||
private final LeaseManager leaseManager; | ||
private final StateStore stateStore; | ||
private final EMRServerlessClientFactory emrServerlessClientFactory; | ||
|
||
public RefreshQueryHandler getRefreshQueryHandler() { | ||
return new RefreshQueryHandler( | ||
emrServerlessClientFactory.getClient(), | ||
jobExecutionResponseReader, | ||
flintIndexMetadataService, | ||
stateStore, | ||
leaseManager); | ||
} | ||
|
||
public StreamingQueryHandler getStreamingQueryHandler() { | ||
return new StreamingQueryHandler( | ||
emrServerlessClientFactory.getClient(), jobExecutionResponseReader, leaseManager); | ||
} | ||
|
||
public BatchQueryHandler getBatchQueryHandler() { | ||
return new BatchQueryHandler( | ||
emrServerlessClientFactory.getClient(), jobExecutionResponseReader, leaseManager); | ||
} | ||
|
||
public InteractiveQueryHandler getInteractiveQueryHandler() { | ||
return new InteractiveQueryHandler(sessionManager, jobExecutionResponseReader, leaseManager); | ||
} | ||
|
||
public IndexDMLHandler getIndexDMLHandler() { | ||
return new IndexDMLHandler( | ||
emrServerlessClientFactory.getClient(), | ||
jobExecutionResponseReader, | ||
flintIndexMetadataService, | ||
stateStore, | ||
client); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.