-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to run MSQ in Quidem tests (#16798)
* implements some jdbc facade to enable msq usage * adds an !msqPlan command * adds more guice usage to testsystem startup
- Loading branch information
Showing
35 changed files
with
977 additions
and
383 deletions.
There are no files selected for viewing
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
89 changes: 89 additions & 0 deletions
89
...ions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/TestMSQSqlModule.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,89 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.druid.msq.exec; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.google.common.collect.ImmutableList; | ||
import com.google.inject.Injector; | ||
import com.google.inject.Provides; | ||
import org.apache.druid.guice.LazySingleton; | ||
import org.apache.druid.initialization.ServerInjectorBuilderTest.TestDruidModule; | ||
import org.apache.druid.msq.guice.MultiStageQuery; | ||
import org.apache.druid.msq.sql.MSQTaskSqlEngine; | ||
import org.apache.druid.msq.test.MSQTestBase; | ||
import org.apache.druid.msq.test.MSQTestOverlordServiceClient; | ||
import org.apache.druid.msq.test.MSQTestTaskActionClient; | ||
import org.apache.druid.sql.SqlStatementFactory; | ||
import org.apache.druid.sql.SqlToolbox; | ||
import org.apache.druid.sql.avatica.DruidMeta; | ||
import org.apache.druid.sql.avatica.MSQDruidMeta; | ||
|
||
public class TestMSQSqlModule extends TestDruidModule | ||
{ | ||
@Provides | ||
@MultiStageQuery | ||
@LazySingleton | ||
public SqlStatementFactory makeMSQSqlStatementFactory( | ||
final MSQTaskSqlEngine sqlEngine, | ||
SqlToolbox toolbox) | ||
{ | ||
return new SqlStatementFactory(toolbox.withEngine(sqlEngine)); | ||
} | ||
|
||
@Provides | ||
@LazySingleton | ||
public MSQTaskSqlEngine createEngine( | ||
ObjectMapper queryJsonMapper, | ||
MSQTestOverlordServiceClient indexingServiceClient) | ||
{ | ||
return new MSQTaskSqlEngine(indexingServiceClient, queryJsonMapper); | ||
} | ||
|
||
@Provides | ||
@LazySingleton | ||
private MSQTestOverlordServiceClient makeOverlordServiceClient( | ||
ObjectMapper queryJsonMapper, | ||
Injector injector, | ||
WorkerMemoryParameters workerMemoryParameters) | ||
{ | ||
final MSQTestOverlordServiceClient indexingServiceClient = new MSQTestOverlordServiceClient( | ||
queryJsonMapper, | ||
injector, | ||
new MSQTestTaskActionClient(queryJsonMapper, injector), | ||
workerMemoryParameters, | ||
ImmutableList.of() | ||
); | ||
return indexingServiceClient; | ||
} | ||
|
||
@Provides | ||
@LazySingleton | ||
private WorkerMemoryParameters makeWorkerMemoryParameters() | ||
{ | ||
return MSQTestBase.makeTestWorkerMemoryParameters(); | ||
} | ||
|
||
@Provides | ||
@LazySingleton | ||
public DruidMeta createMeta(MSQDruidMeta druidMeta) | ||
{ | ||
return druidMeta; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...sions-core/multi-stage-query/src/test/java/org/apache/druid/msq/quidem/MSQQuidemTest.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,39 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.druid.msq.quidem; | ||
|
||
import org.apache.druid.quidem.DruidQuidemTestBase; | ||
import org.apache.druid.quidem.ProjectPathUtils; | ||
import java.io.File; | ||
|
||
public class MSQQuidemTest extends DruidQuidemTestBase | ||
{ | ||
|
||
public MSQQuidemTest() | ||
{ | ||
super(); | ||
} | ||
|
||
@Override | ||
protected File getTestRoot() | ||
{ | ||
return ProjectPathUtils.getPathFromProjectRoot("extensions-core/multi-stage-query/src/test/quidem/" + getClass().getName()); | ||
} | ||
} |
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.