Search in sources :

Example 1 with ExecutorProvider

use of io.mycat.calcite.ExecutorProvider in project Mycat2 by MyCATApache.

the class ObservablePlanImplementorImpl method executeQuery.

@Override
public Future<Void> executeQuery(Plan plan) {
    AsyncMycatDataContextImpl.SqlMycatDataContextImpl sqlMycatDataContext = new AsyncMycatDataContextImpl.SqlMycatDataContextImpl(context, plan.getCodeExecuterContext(), drdsSqlWithParams);
    ExecutorProvider executorProvider = MetaClusterCurrent.wrapper(ExecutorProvider.class);
    PrepareExecutor prepare = executorProvider.prepare(plan);
    if (context.isVector()) {
        PrepareExecutor.ArrowObservable observable1 = prepare.asObservableVector(sqlMycatDataContext, plan.getMetaData());
        return response.sendVectorResultSet(observable1.getMycatRowMetaData(), observable1.getObservable());
    } else {
        ArrayBindable arrayBindable = prepare.getArrayBindable();
        Observable<MysqlPayloadObject> observable1 = PrepareExecutor.getMysqlPayloadObjectObservable(arrayBindable, sqlMycatDataContext, plan.getMetaData());
        Observable observable = mapToTimeoutObservable(observable1, drdsSqlWithParams);
        String parameterizedSQL = drdsSqlWithParams.getParameterizedSQL();
        Future<Void> take = TimeRateLimiterService.STRING_INSTANCE.take(parameterizedSQL);
        Observable<MysqlPayloadObject> executor = observable;
        return response.sendResultSet(executor);
    }
}
Also used : PrepareExecutor(io.mycat.calcite.PrepareExecutor) MysqlPayloadObject(io.mycat.api.collector.MysqlPayloadObject) Observable(io.reactivex.rxjava3.core.Observable) ArrayBindable(org.apache.calcite.runtime.ArrayBindable) ExecutorProvider(io.mycat.calcite.ExecutorProvider)

Aggregations

MysqlPayloadObject (io.mycat.api.collector.MysqlPayloadObject)1 ExecutorProvider (io.mycat.calcite.ExecutorProvider)1 PrepareExecutor (io.mycat.calcite.PrepareExecutor)1 Observable (io.reactivex.rxjava3.core.Observable)1 ArrayBindable (org.apache.calcite.runtime.ArrayBindable)1