Skip to content

Commit 9ec3c85

Browse files
committed
Remove unused code and test
Signed-off-by: Chen Dai <[email protected]>
1 parent e1f32a9 commit 9ec3c85

File tree

7 files changed

+10
-593
lines changed

7 files changed

+10
-593
lines changed

async-query-core/src/main/java/org/opensearch/sql/spark/dispatcher/IndexDMLHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ private FlintIndexOp getIndexOp(
138138
case ALTER:
139139
return flintIndexOpFactory.getAlter(
140140
indexQueryDetails.getFlintIndexOptions(), dispatchQueryRequest.getDatasource());
141-
case VACUUM:
142-
return flintIndexOpFactory.getVacuum(dispatchQueryRequest.getDatasource());
143141
default:
144142
throw new IllegalStateException(
145143
String.format(

async-query-core/src/main/java/org/opensearch/sql/spark/flint/operation/FlintIndexOpFactory.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ public FlintIndexOpAlter getAlter(FlintIndexOptions flintIndexOptions, String da
3636
asyncQueryScheduler);
3737
}
3838

39-
public FlintIndexOpVacuum getVacuum(String datasource) {
40-
return new FlintIndexOpVacuum(
41-
flintIndexStateModelService,
42-
datasource,
43-
flintIndexClient,
44-
emrServerlessClientFactory,
45-
asyncQueryScheduler);
46-
}
47-
4839
public FlintIndexOpCancel getCancel(String datasource) {
4940
return new FlintIndexOpCancel(
5041
flintIndexStateModelService, datasource, emrServerlessClientFactory);

async-query-core/src/main/java/org/opensearch/sql/spark/flint/operation/FlintIndexOpVacuum.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

async-query-core/src/test/java/org/opensearch/sql/spark/asyncquery/AsyncQueryCoreIntegTest.java

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -236,32 +236,12 @@ public void createDropIndexQueryWithScheduler() {
236236
public void createVacuumIndexQuery() {
237237
givenSparkExecutionEngineConfigIsSupplied();
238238
givenValidDataSourceMetadataExist();
239+
givenSessionExists();
239240
when(queryIdProvider.getQueryId(any(), eq(asyncQueryRequestContext))).thenReturn(QUERY_ID);
240-
String indexName = "flint_datasource_name_table_name_index_name_index";
241-
givenFlintIndexMetadataExists(indexName);
242-
243-
CreateAsyncQueryResponse response =
244-
asyncQueryExecutorService.createAsyncQuery(
245-
new CreateAsyncQueryRequest(
246-
"VACUUM INDEX index_name ON table_name", DATASOURCE_NAME, LangType.SQL),
247-
asyncQueryRequestContext);
248-
249-
assertEquals(QUERY_ID, response.getQueryId());
250-
assertNull(response.getSessionId());
251-
verifyGetQueryIdCalled();
252-
verify(flintIndexClient).deleteIndex(indexName);
253-
verifyCreateIndexDMLResultCalled();
254-
verifyStoreJobMetadataCalled(DML_QUERY_JOB_ID, JobType.BATCH);
255-
}
256-
257-
@Test
258-
public void createVacuumIndexQueryWithScheduler() {
259-
givenSparkExecutionEngineConfigIsSupplied();
260-
givenValidDataSourceMetadataExist();
261-
when(queryIdProvider.getQueryId(any(), eq(asyncQueryRequestContext))).thenReturn(QUERY_ID);
262-
263-
String indexName = "flint_datasource_name_table_name_index_name_index";
264-
givenFlintIndexMetadataExistsWithExternalScheduler(indexName);
241+
when(sessionIdProvider.getSessionId(any())).thenReturn(SESSION_ID);
242+
givenSessionExists(); // called twice
243+
when(awsemrServerless.startJobRun(any()))
244+
.thenReturn(new StartJobRunResult().withApplicationId(APPLICATION_ID).withJobRunId(JOB_ID));
265245

266246
CreateAsyncQueryResponse response =
267247
asyncQueryExecutorService.createAsyncQuery(
@@ -270,14 +250,12 @@ public void createVacuumIndexQueryWithScheduler() {
270250
asyncQueryRequestContext);
271251

272252
assertEquals(QUERY_ID, response.getQueryId());
273-
assertNull(response.getSessionId());
253+
assertEquals(SESSION_ID, response.getSessionId());
274254
verifyGetQueryIdCalled();
275-
276-
verify(flintIndexClient).deleteIndex(indexName);
277-
verifyCreateIndexDMLResultCalled();
278-
verifyStoreJobMetadataCalled(DML_QUERY_JOB_ID, JobType.BATCH);
279-
280-
verify(asyncQueryScheduler).removeJob(indexName);
255+
verifyGetSessionIdCalled();
256+
verify(leaseManager).borrow(any());
257+
verifyStartJobRunCalled();
258+
verifyStoreJobMetadataCalled(JOB_ID, JobType.INTERACTIVE);
281259
}
282260

283261
@Test

async-query-core/src/test/java/org/opensearch/sql/spark/flint/operation/FlintIndexOpFactoryTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ void getAlter() {
4141
assertNotNull(flintIndexOpFactory.getAlter(new FlintIndexOptions(), DATASOURCE_NAME));
4242
}
4343

44-
@Test
45-
void getVacuum() {
46-
assertNotNull(flintIndexOpFactory.getDrop(DATASOURCE_NAME));
47-
}
48-
4944
@Test
5045
void getCancel() {
5146
assertNotNull(flintIndexOpFactory.getDrop(DATASOURCE_NAME));

0 commit comments

Comments
 (0)