Search in sources :

Example 11 with DrdsSqlCompiler

use of io.mycat.DrdsSqlCompiler in project Mycat2 by MyCATApache.

the class UnionAllTest method parse.

public static Explain parse(String sql) {
    DrdsSqlCompiler drds = getDrds();
    DrdsSqlWithParams drdsSqlWithParams = DrdsRunnerHelper.preParse(sql, null);
    OptimizationContext optimizationContext = new OptimizationContext();
    MycatRel dispatch = drds.dispatch(optimizationContext, drdsSqlWithParams);
    Plan plan = new PlanImpl(dispatch, DrdsExecutorCompiler.getCodeExecuterContext(optimizationContext.relNodeContext.getConstantMap(), dispatch, false), drdsSqlWithParams.getAliasList());
    return new Explain(plan, drdsSqlWithParams);
}
Also used : DrdsSqlCompiler(io.mycat.DrdsSqlCompiler) MycatRel(io.mycat.calcite.MycatRel) OptimizationContext(io.mycat.calcite.rewriter.OptimizationContext) Plan(io.mycat.calcite.spm.Plan) DrdsSqlWithParams(io.mycat.DrdsSqlWithParams) PlanImpl(io.mycat.calcite.spm.PlanImpl)

Example 12 with DrdsSqlCompiler

use of io.mycat.DrdsSqlCompiler in project Mycat2 by MyCATApache.

the class AllShardingJoinTest method parse.

public static Explain parse(String sql) {
    DrdsSqlCompiler drds = getDrds();
    DrdsSqlWithParams drdsSqlWithParams = DrdsRunnerHelper.preParse(sql, null);
    OptimizationContext optimizationContext = new OptimizationContext();
    MycatRel dispatch = drds.dispatch(optimizationContext, drdsSqlWithParams);
    Plan plan = new PlanImpl(dispatch, DrdsExecutorCompiler.getCodeExecuterContext(optimizationContext.relNodeContext.getConstantMap(), dispatch, false), drdsSqlWithParams.getAliasList());
    return new Explain(plan, drdsSqlWithParams);
}
Also used : DrdsSqlCompiler(io.mycat.DrdsSqlCompiler) MycatRel(io.mycat.calcite.MycatRel) OptimizationContext(io.mycat.calcite.rewriter.OptimizationContext) Plan(io.mycat.calcite.spm.Plan) DrdsSqlWithParams(io.mycat.DrdsSqlWithParams) PlanImpl(io.mycat.calcite.spm.PlanImpl)

Aggregations

DrdsSqlCompiler (io.mycat.DrdsSqlCompiler)12 MetadataManager (io.mycat.MetadataManager)5 ValuePredicateAnalyzer (io.mycat.calcite.rewriter.ValuePredicateAnalyzer)5 ShardingTable (io.mycat.calcite.table.ShardingTable)5 RexNode (org.apache.calcite.rex.RexNode)5 Test (org.junit.Test)5 DrdsSqlWithParams (io.mycat.DrdsSqlWithParams)4 MycatRel (io.mycat.calcite.MycatRel)4 OptimizationContext (io.mycat.calcite.rewriter.OptimizationContext)4 Plan (io.mycat.calcite.spm.Plan)4 PlanImpl (io.mycat.calcite.spm.PlanImpl)4 DrdsConst (io.mycat.DrdsConst)3 NameMap (io.mycat.util.NameMap)3 Partition (io.mycat.Partition)2 QueryType (io.mycat.querycondition.QueryType)1