mirror of https://github.com/apache/druid.git
move to new file
This commit is contained in:
parent
d010b488a7
commit
a489e19242
|
@ -20,27 +20,17 @@
|
||||||
package org.apache.druid.msq.exec;
|
package org.apache.druid.msq.exec;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provides;
|
|
||||||
import org.apache.druid.guice.DruidInjectorBuilder;
|
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||||
import org.apache.druid.guice.LazySingleton;
|
|
||||||
import org.apache.druid.initialization.ServerInjectorBuilderTest.TestDruidModule;
|
|
||||||
import org.apache.druid.msq.exec.MSQDrillWindowQueryTest.DrillWindowQueryMSQComponentSupplier;
|
import org.apache.druid.msq.exec.MSQDrillWindowQueryTest.DrillWindowQueryMSQComponentSupplier;
|
||||||
import org.apache.druid.msq.guice.MultiStageQuery;
|
|
||||||
import org.apache.druid.msq.sql.MSQTaskSqlEngine;
|
import org.apache.druid.msq.sql.MSQTaskSqlEngine;
|
||||||
import org.apache.druid.msq.test.CalciteMSQTestsHelper;
|
import org.apache.druid.msq.test.CalciteMSQTestsHelper;
|
||||||
import org.apache.druid.msq.test.ExtractResultsFactory;
|
import org.apache.druid.msq.test.ExtractResultsFactory;
|
||||||
import org.apache.druid.msq.test.MSQTestOverlordServiceClient;
|
import org.apache.druid.msq.test.MSQTestOverlordServiceClient;
|
||||||
import org.apache.druid.msq.test.MSQTestTaskActionClient;
|
|
||||||
import org.apache.druid.msq.test.VerifyMSQSupportedNativeQueriesPredicate;
|
import org.apache.druid.msq.test.VerifyMSQSupportedNativeQueriesPredicate;
|
||||||
import org.apache.druid.query.groupby.TestGroupByBuffers;
|
import org.apache.druid.query.groupby.TestGroupByBuffers;
|
||||||
import org.apache.druid.server.QueryLifecycleFactory;
|
import org.apache.druid.server.QueryLifecycleFactory;
|
||||||
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;
|
|
||||||
import org.apache.druid.sql.calcite.DrillWindowQueryTest;
|
import org.apache.druid.sql.calcite.DrillWindowQueryTest;
|
||||||
import org.apache.druid.sql.calcite.QueryTestBuilder;
|
import org.apache.druid.sql.calcite.QueryTestBuilder;
|
||||||
import org.apache.druid.sql.calcite.SqlTestFrameworkConfig;
|
import org.apache.druid.sql.calcite.SqlTestFrameworkConfig;
|
||||||
|
@ -65,62 +55,6 @@ public class MSQDrillWindowQueryTest extends DrillWindowQueryTest
|
||||||
builder.addModule(new TestMSQSqlModule());
|
builder.addModule(new TestMSQSqlModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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(
|
|
||||||
QueryLifecycleFactory qlf,
|
|
||||||
ObjectMapper queryJsonMapper,
|
|
||||||
Injector injector,
|
|
||||||
MSQTestOverlordServiceClient indexingServiceClient
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return new MSQTaskSqlEngine(indexingServiceClient, queryJsonMapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@LazySingleton
|
|
||||||
private MSQTestOverlordServiceClient extracted(ObjectMapper queryJsonMapper, Injector injector)
|
|
||||||
{
|
|
||||||
final WorkerMemoryParameters workerMemoryParameters = WorkerMemoryParameters.createInstance(
|
|
||||||
WorkerMemoryParameters.PROCESSING_MINIMUM_BYTES * 50,
|
|
||||||
2,
|
|
||||||
10,
|
|
||||||
2,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
final MSQTestOverlordServiceClient indexingServiceClient = new MSQTestOverlordServiceClient(
|
|
||||||
queryJsonMapper,
|
|
||||||
injector,
|
|
||||||
new MSQTestTaskActionClient(queryJsonMapper, injector),
|
|
||||||
workerMemoryParameters,
|
|
||||||
ImmutableList.of()
|
|
||||||
);
|
|
||||||
return indexingServiceClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@LazySingleton
|
|
||||||
public DruidMeta createMeta(
|
|
||||||
MSQDruidMeta druidMeta)
|
|
||||||
{
|
|
||||||
return druidMeta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqlEngine createEngine(
|
public SqlEngine createEngine(
|
||||||
QueryLifecycleFactory qlf,
|
QueryLifecycleFactory qlf,
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* 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.MSQTestOverlordServiceClient;
|
||||||
|
import org.apache.druid.msq.test.MSQTestTaskActionClient;
|
||||||
|
import org.apache.druid.server.QueryLifecycleFactory;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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(
|
||||||
|
QueryLifecycleFactory qlf,
|
||||||
|
ObjectMapper queryJsonMapper,
|
||||||
|
Injector injector,
|
||||||
|
MSQTestOverlordServiceClient indexingServiceClient
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return new MSQTaskSqlEngine(indexingServiceClient, queryJsonMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
private MSQTestOverlordServiceClient extracted(ObjectMapper queryJsonMapper, Injector injector)
|
||||||
|
{
|
||||||
|
final WorkerMemoryParameters workerMemoryParameters = WorkerMemoryParameters.createInstance(
|
||||||
|
WorkerMemoryParameters.PROCESSING_MINIMUM_BYTES * 50,
|
||||||
|
2,
|
||||||
|
10,
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
final MSQTestOverlordServiceClient indexingServiceClient = new MSQTestOverlordServiceClient(
|
||||||
|
queryJsonMapper,
|
||||||
|
injector,
|
||||||
|
new MSQTestTaskActionClient(queryJsonMapper, injector),
|
||||||
|
workerMemoryParameters,
|
||||||
|
ImmutableList.of()
|
||||||
|
);
|
||||||
|
return indexingServiceClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
public DruidMeta createMeta(
|
||||||
|
MSQDruidMeta druidMeta)
|
||||||
|
{
|
||||||
|
return druidMeta;
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,7 +94,7 @@ order by 1;
|
||||||
"finalize" : true,
|
"finalize" : true,
|
||||||
"maxParseExceptions" : 0,
|
"maxParseExceptions" : 0,
|
||||||
"plannerStrategy" : "DECOUPLED",
|
"plannerStrategy" : "DECOUPLED",
|
||||||
"sqlQueryId" : "d192187f-8ad1-458d-919e-b07a084156e9",
|
"sqlQueryId" : "86f85662-42c2-462f-8d1f-a692c33ebe99",
|
||||||
"sqlStringifyArrays" : false
|
"sqlStringifyArrays" : false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ order by 1;
|
||||||
"partitionCount" : 1,
|
"partitionCount" : 1,
|
||||||
"shuffle" : "globalSort",
|
"shuffle" : "globalSort",
|
||||||
"output" : "localStorage",
|
"output" : "localStorage",
|
||||||
"startTime" : "2024-07-24T17:16:24.473Z",
|
"startTime" : "2024-07-24T17:24:33.755Z",
|
||||||
"duration" : 612,
|
"duration" : 657,
|
||||||
"sort" : true
|
"sort" : true
|
||||||
}, {
|
}, {
|
||||||
"stageNumber" : 1,
|
"stageNumber" : 1,
|
||||||
|
@ -200,7 +200,7 @@ order by 1;
|
||||||
"finalize" : true,
|
"finalize" : true,
|
||||||
"maxParseExceptions" : 0,
|
"maxParseExceptions" : 0,
|
||||||
"plannerStrategy" : "DECOUPLED",
|
"plannerStrategy" : "DECOUPLED",
|
||||||
"sqlQueryId" : "d192187f-8ad1-458d-919e-b07a084156e9",
|
"sqlQueryId" : "86f85662-42c2-462f-8d1f-a692c33ebe99",
|
||||||
"sqlStringifyArrays" : false
|
"sqlStringifyArrays" : false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ order by 1;
|
||||||
"workerCount" : 1,
|
"workerCount" : 1,
|
||||||
"partitionCount" : 1,
|
"partitionCount" : 1,
|
||||||
"output" : "localStorage",
|
"output" : "localStorage",
|
||||||
"startTime" : "2024-07-24T17:16:25.085Z",
|
"startTime" : "2024-07-24T17:24:34.412Z",
|
||||||
"duration" : 2
|
"duration" : 2
|
||||||
} ]
|
} ]
|
||||||
!msqPlan
|
!msqPlan
|
||||||
|
|
Loading…
Reference in New Issue