Search in sources :

Example 26 with MycatView

use of io.mycat.calcite.logical.MycatView in project Mycat2 by MyCATApache.

the class MycatViewPlan method execute.

@Override
public Observable<VectorSchemaRoot> execute(RootContext rootContext) {
    RootAllocator rootAllocator = new RootAllocator();
    NewMycatDataContext context = (NewMycatDataContext) rootContext.getContext();
    DrdsSqlWithParams drdsSql = context.getDrdsSql();
    MycatView view = (MycatView) mycatView;
    CopyMycatRowMetaData rowMetaData = new CopyMycatRowMetaData(new CalciteRowMetaData(view.getRowType().getFieldList()));
    MycatRelDatasourceSourceInfo mycatRelDatasourceSourceInfo = new MycatRelDatasourceSourceInfo(rowMetaData, view.getSQLTemplate(DrdsSql.isForUpdate(drdsSql.getParameterizedStatement())), view);
    SqlNode sqlTemplate = mycatRelDatasourceSourceInfo.getSqlTemplate();
    List<PartitionGroup> partitionGroups = AsyncMycatDataContextImpl.getSqlMap(Collections.emptyMap(), view, drdsSql, drdsSql.getHintDataNodeFilter());
    ImmutableMultimap<String, SqlString> stringSqlStringImmutableMultimap = view.apply(-1, sqlTemplate, partitionGroups, drdsSql.getParams());
    List<Observable<VectorSchemaRoot>> observableList = new ArrayList<>();
    for (Map.Entry<String, SqlString> entry : stringSqlStringImmutableMultimap.entries()) {
        String key = entry.getKey();
        SqlString sqlString = entry.getValue();
        observableList.add(Observable.create(emitter -> {
            Future<NewMycatConnection> connectionFuture = context.getConnection(context.getContext().resolveDatasourceTargetName(key));
            Future<Observable<VectorSchemaRoot>> observableFuture = connectionFuture.map(connection -> {
                Observable<VectorSchemaRoot> observable = connection.prepareQuery(sqlString.getSql(), MycatPreparedStatementUtil.extractParams(drdsSql.getParams(), sqlString.getDynamicParameters()), MycatRelDataType.getMycatRelType(MycatViewPlan.this.schema()), rootAllocator);
                return observable.doOnComplete(() -> context.recycleConnection(context.getContext().resolveDatasourceTargetName(key), Future.succeededFuture(connection)));
            });
            observableFuture.onFailure(event -> emitter.tryOnError(event));
            observableFuture.onSuccess(event -> {
                event = event.doOnComplete(() -> emitter.onComplete());
                event = event.doOnError(throwable -> emitter.tryOnError(throwable));
                event.forEach(vectorSchemaRoot -> emitter.onNext(vectorSchemaRoot));
            });
        }));
    }
    return Observable.fromIterable(observableList).flatMap(i -> i);
}
Also used : PartitionGroup(io.mycat.PartitionGroup) Schema(org.apache.arrow.vector.types.pojo.Schema) PartitionGroup(io.mycat.PartitionGroup) PhysicalSortProperty(io.ordinate.engine.builder.PhysicalSortProperty) CalciteRowMetaData(io.mycat.calcite.resultset.CalciteRowMetaData) CalciteCompiler(io.ordinate.engine.builder.CalciteCompiler) ObservableOnSubscribe(io.reactivex.rxjava3.core.ObservableOnSubscribe) SqlNode(org.apache.calcite.sql.SqlNode) RexNode(org.apache.calcite.rex.RexNode) DrdsSqlWithParams(io.mycat.DrdsSqlWithParams) RootAllocator(org.apache.arrow.memory.RootAllocator) Map(java.util.Map) BufferAllocator(org.apache.arrow.memory.BufferAllocator) MycatMergeSort(io.mycat.calcite.physical.MycatMergeSort) SqlKind(org.apache.calcite.sql.SqlKind) NewMycatConnection(io.mycat.newquery.NewMycatConnection) MycatView(io.mycat.calcite.logical.MycatView) RexLiteral(org.apache.calcite.rex.RexLiteral) Field(org.apache.arrow.vector.types.pojo.Field) FactoryUtil(io.ordinate.engine.factory.FactoryUtil) RootContext(io.ordinate.engine.record.RootContext) Future(io.vertx.core.Future) RelFieldCollation(org.apache.calcite.rel.RelFieldCollation) Collectors(java.util.stream.Collectors) Action(io.reactivex.rxjava3.functions.Action) List(java.util.List) RelCollation(org.apache.calcite.rel.RelCollation) Sort(org.apache.calcite.rel.core.Sort) MycatPreparedStatementUtil(io.mycat.calcite.executor.MycatPreparedStatementUtil) SqlString(org.apache.calcite.sql.util.SqlString) RexCall(org.apache.calcite.rex.RexCall) VertxExecuter(io.mycat.vertx.VertxExecuter) Distribution(io.mycat.calcite.rewriter.Distribution) NewMycatDataContext(org.apache.calcite.runtime.NewMycatDataContext) NonNull(io.reactivex.rxjava3.annotations.NonNull) ArrayList(java.util.ArrayList) Observable(io.reactivex.rxjava3.core.Observable) IntFunction(io.ordinate.engine.function.IntFunction) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) MycatRelDataType(io.mycat.beans.mycat.MycatRelDataType) CopyMycatRowMetaData(io.mycat.beans.mycat.CopyMycatRowMetaData) VectorSchemaRoot(org.apache.arrow.vector.VectorSchemaRoot) MycatRelDatasourceSourceInfo(io.mycat.calcite.MycatRelDatasourceSourceInfo) Consumer(io.reactivex.rxjava3.functions.Consumer) ObservableEmitter(io.reactivex.rxjava3.core.ObservableEmitter) AsyncMycatDataContextImpl(io.mycat.AsyncMycatDataContextImpl) DrdsSql(io.mycat.DrdsSql) Function(io.reactivex.rxjava3.functions.Function) Handler(io.vertx.core.Handler) Collections(java.util.Collections) VectorSchemaRoot(org.apache.arrow.vector.VectorSchemaRoot) ArrayList(java.util.ArrayList) SqlString(org.apache.calcite.sql.util.SqlString) CopyMycatRowMetaData(io.mycat.beans.mycat.CopyMycatRowMetaData) Observable(io.reactivex.rxjava3.core.Observable) DrdsSqlWithParams(io.mycat.DrdsSqlWithParams) SqlString(org.apache.calcite.sql.util.SqlString) MycatView(io.mycat.calcite.logical.MycatView) RootAllocator(org.apache.arrow.memory.RootAllocator) MycatRelDatasourceSourceInfo(io.mycat.calcite.MycatRelDatasourceSourceInfo) NewMycatDataContext(org.apache.calcite.runtime.NewMycatDataContext) Future(io.vertx.core.Future) CalciteRowMetaData(io.mycat.calcite.resultset.CalciteRowMetaData) Map(java.util.Map) SqlNode(org.apache.calcite.sql.SqlNode)

Example 27 with MycatView

use of io.mycat.calcite.logical.MycatView in project Mycat2 by MyCATApache.

the class VertxUpdateExecuter method explainUpdate.

@SneakyThrows
public static Collection<VertxExecuter.EachSQL> explainUpdate(DrdsSqlWithParams drdsSqlWithParams, MycatDataContext context) {
    SQLStatement statement = drdsSqlWithParams.getParameterizedStatement();
    List<Object> maybeList = drdsSqlWithParams.getParams();
    boolean multi = !maybeList.isEmpty() && maybeList.get(0) instanceof List;
    List<List<Object>> paramList = multi ? (List) maybeList : Collections.singletonList(maybeList);
    List<VertxExecuter.EachSQL> res = new ArrayList<>();
    for (List<Object> params : paramList) {
        SQLExprTableSource tableSource = (SQLExprTableSource) getTableSource(statement);
        String alias = SQLUtils.normalize(tableSource.computeAlias());
        String tableName = SQLUtils.normalize(tableSource.getTableName());
        String schemaName = SQLUtils.normalize(tableSource.getSchema());
        MetadataManager metadataManager = MetaClusterCurrent.wrapper(MetadataManager.class);
        TableHandler table = metadataManager.getTable(schemaName, tableName);
        switch(table.getType()) {
            case SHARDING:
                {
                    ShardingTable shardingTable = (ShardingTable) table;
                    SimpleColumnInfo primaryKey = shardingTable.getPrimaryKey();
                    SQLExpr where = getWhere(statement);
                    if (where == null) {
                        handleEmptyWhereSharding(statement, res, params, shardingTable);
                        continue;
                    }
                    SQLSelectStatement sqlSelectStatement = new SQLSelectStatement();
                    SQLSelect sqlSelect = new SQLSelect();
                    sqlSelect.setQuery(new SQLSelectQueryBlock());
                    sqlSelectStatement.setSelect(sqlSelect);
                    SQLSelectQueryBlock queryBlock = sqlSelectStatement.getSelect().getQueryBlock();
                    queryBlock.addWhere(where);
                    queryBlock.setFrom(tableSource.clone());
                    Set<String> selectKeys = getSelectKeys(shardingTable, primaryKey);
                    for (String selectKey : selectKeys) {
                        queryBlock.addSelectItem(new SQLPropertyExpr(alias, selectKey), selectKey);
                    }
                    List<Object> innerParams = new ArrayList<>();
                    List<SqlTypeName> innerTypes = new ArrayList<>();
                    List<SqlTypeName> typeNames = drdsSqlWithParams.getTypeNames();
                    where.accept(new MySqlASTVisitorAdapter() {

                        @Override
                        public boolean visit(SQLVariantRefExpr x) {
                            innerParams.add(params.get(x.getIndex()));
                            if (!typeNames.isEmpty()) {
                                innerTypes.add(typeNames.get(x.getIndex()));
                            }
                            return false;
                        }
                    });
                    DrdsSqlWithParams queryDrdsSqlWithParams = new DrdsSqlWithParams(sqlSelectStatement.toString(), innerParams, false, innerTypes, Collections.emptyList(), Collections.emptyList());
                    QueryPlanner planCache = MetaClusterCurrent.wrapper(QueryPlanner.class);
                    List<CodeExecuterContext> acceptedMycatRelList = planCache.getAcceptedMycatRelList(queryDrdsSqlWithParams);
                    CodeExecuterContext codeExecuterContext = acceptedMycatRelList.get(0);
                    MycatView mycatRel = (MycatView) codeExecuterContext.getMycatRel();
                    List<PartitionGroup> sqlMap = AsyncMycatDataContextImpl.getSqlMap(Collections.emptyMap(), mycatRel, queryDrdsSqlWithParams, drdsSqlWithParams.getHintDataNodeFilter());
                    List<Partition> partitions = sqlMap.stream().map(partitionGroup -> partitionGroup.get(shardingTable.getUniqueName())).collect(Collectors.toList());
                    handleTargets(statement, res, params, partitions);
                    if (shardingTable.getIndexTables().isEmpty()) {
                        continue;
                    }
                    // //////////////////////////////////////index-scan////////////////////////////////////////////////////////////
                    Objects.requireNonNull(shardingTable.getPrimaryKey(), " need primary key");
                    RowBaseIterator bindable = MetaClusterCurrent.wrapper(ExecutorProvider.class).runAsObjectArray(context, sqlSelectStatement.toString());
                    try {
                        List<Object[]> list = new ArrayList<>();
                        while (bindable.next()) {
                            list.add(bindable.getObjects());
                        }
                        if (list.size() > 1000) {
                            throw new IllegalArgumentException("The number of update rows exceeds the limit.");
                        }
                        for (ShardingTable indexTable : shardingTable.getIndexTables()) {
                            SQLStatement eachStatement = SQLUtils.parseSingleMysqlStatement(drdsSqlWithParams.getParameterizedSQL());
                            SQLExprTableSource sqlTableSource = new SQLExprTableSource();
                            sqlTableSource.setExpr(indexTable.getTableName());
                            sqlTableSource.setSchema(indexTable.getSchemaName());
                            setFrom(eachStatement, sqlTableSource);
                            RelDataType rowType = codeExecuterContext.getMycatRel().getRowType();
                            List<SQLExpr> backConditions = getBackCondition(selectKeys, indexTable, rowType);
                            setWhere(eachStatement, backConditions.stream().reduce((sqlExpr, sqlExpr2) -> SQLBinaryOpExpr.and(sqlExpr, sqlExpr2)).orElse(null));
                            for (Object[] eachParams : list) {
                                List<Object> newEachParams = getNewEachParams(backConditions, eachParams);
                                Collection<VertxExecuter.EachSQL> eachSQLS = VertxUpdateExecuter.explainUpdate(new DrdsSqlWithParams(eachStatement.toString(), newEachParams, false, getTypes(newEachParams), Collections.emptyList(), Collections.emptyList()), context);
                                res.addAll(eachSQLS);
                            }
                        }
                        continue;
                    } finally {
                        context.getTransactionSession().closeStatementState().toCompletionStage().toCompletableFuture().get(1, TimeUnit.SECONDS);
                    }
                }
            case GLOBAL:
                {
                    GlobalTable globalTable = (GlobalTable) table;
                    handleTargets(statement, res, params, globalTable.getGlobalDataNode());
                    continue;
                }
            case NORMAL:
                {
                    handleNormal(statement, res, params, (NormalTable) table);
                    continue;
                }
            case CUSTOM:
                throw new UnsupportedOperationException();
            default:
                throw new IllegalStateException("Unexpected value: " + table.getType());
        }
    }
    return res;
}
Also used : MySqlASTVisitorAdapter(com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitorAdapter) ShardingTable(io.mycat.calcite.table.ShardingTable) QueryPlanner(io.mycat.calcite.spm.QueryPlanner) java.util(java.util) SQLIdentifierExpr(com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr) io.mycat(io.mycat) SneakyThrows(lombok.SneakyThrows) LoggerFactory(org.slf4j.LoggerFactory) ShardingIndexTable(io.mycat.calcite.table.ShardingIndexTable) SQLBinaryOpExpr(com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr) SQLPropertyExpr(com.alibaba.druid.sql.ast.expr.SQLPropertyExpr) MySqlASTVisitorAdapter(com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitorAdapter) ImmutableList(com.google.common.collect.ImmutableList) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) GlobalTable(io.mycat.calcite.table.GlobalTable) SQLVariantRefExpr(com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr) DrdsRunnerHelper.getTypes(io.mycat.calcite.DrdsRunnerHelper.getTypes) RelDataType(org.apache.calcite.rel.type.RelDataType) SQLUtils(com.alibaba.druid.sql.SQLUtils) Logger(org.slf4j.Logger) SqlTypeName(org.apache.calcite.sql.type.SqlTypeName) MycatView(io.mycat.calcite.logical.MycatView) ExecutorProvider(io.mycat.calcite.ExecutorProvider) SQLExpr(com.alibaba.druid.sql.ast.SQLExpr) Collectors(java.util.stream.Collectors) TimeUnit(java.util.concurrent.TimeUnit) NormalTable(io.mycat.calcite.table.NormalTable) RelDataTypeField(org.apache.calcite.rel.type.RelDataTypeField) CodeExecuterContext(io.mycat.calcite.CodeExecuterContext) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) NotNull(org.jetbrains.annotations.NotNull) com.alibaba.druid.sql.ast.statement(com.alibaba.druid.sql.ast.statement) CodeExecuterContext(io.mycat.calcite.CodeExecuterContext) RelDataType(org.apache.calcite.rel.type.RelDataType) SQLPropertyExpr(com.alibaba.druid.sql.ast.expr.SQLPropertyExpr) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement) MycatView(io.mycat.calcite.logical.MycatView) GlobalTable(io.mycat.calcite.table.GlobalTable) ImmutableList(com.google.common.collect.ImmutableList) RowBaseIterator(io.mycat.api.collector.RowBaseIterator) ShardingTable(io.mycat.calcite.table.ShardingTable) SQLExpr(com.alibaba.druid.sql.ast.SQLExpr) QueryPlanner(io.mycat.calcite.spm.QueryPlanner) NormalTable(io.mycat.calcite.table.NormalTable) SQLVariantRefExpr(com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr) SneakyThrows(lombok.SneakyThrows)

Example 28 with MycatView

use of io.mycat.calcite.logical.MycatView in project Mycat2 by MyCATApache.

the class DrdsExecutorCompiler method getCodeExecuterContext.

@NotNull
@SneakyThrows
public static CodeExecuterContext getCodeExecuterContext(Map<RexNode, RexNode> constantMap, MycatRel relNode, boolean forUpdate) {
    HashMap<String, Object> varContext = new HashMap<>(2);
    StreamMycatEnumerableRelImplementor mycatEnumerableRelImplementor = new StreamMycatEnumerableRelImplementor(varContext);
    HashMap<String, MycatRelDatasourceSourceInfo> stat = new HashMap<>();
    relNode.accept(new RelShuttleImpl() {

        @Override
        public RelNode visit(RelNode other) {
            CopyMycatRowMetaData rowMetaData = new CopyMycatRowMetaData(new CalciteRowMetaData(other.getRowType().getFieldList()));
            if (other instanceof MycatView) {
                MycatView view = (MycatView) other;
                MycatRelDatasourceSourceInfo rel = stat.computeIfAbsent(other.getDigest(), s -> {
                    return new MycatRelDatasourceSourceInfo(rowMetaData, view.getSQLTemplate(forUpdate), view);
                });
                rel.refCount += 1;
            }
            if (other instanceof MycatTransientSQLTableScan) {
                MycatTransientSQLTableScan tableScan = (MycatTransientSQLTableScan) other;
                MycatRelDatasourceSourceInfo rel = stat.computeIfAbsent(other.getDigest(), s -> {
                    return new MycatRelDatasourceSourceInfo(rowMetaData, new TextSqlNode(tableScan.getSql()), tableScan);
                });
                rel.refCount += 1;
            }
            if (other instanceof MycatSQLTableLookup) {
                MycatView right = ((MycatSQLTableLookup) other).getRight();
                right.accept(this);
            }
            return super.visit(other);
        }
    });
    ClassDeclaration classDeclaration = mycatEnumerableRelImplementor.implementHybridRoot(relNode, EnumerableRel.Prefer.ARRAY);
    String code = Expressions.toString(classDeclaration.memberDeclarations, "\n", false);
    if (log.isDebugEnabled()) {
        log.debug("----------------------------------------code----------------------------------------");
        log.debug(code);
    }
    CodeContext codeContext = new CodeContext(classDeclaration.name, code);
    CodeExecuterContext executerContext = CodeExecuterContext.of(constantMap, stat, varContext, relNode, codeContext);
    return executerContext;
}
Also used : java.util(java.util) SneakyThrows(lombok.SneakyThrows) RelShuttleImpl(org.apache.calcite.rel.RelShuttleImpl) LoggerFactory(org.slf4j.LoggerFactory) CalciteRowMetaData(io.mycat.calcite.resultset.CalciteRowMetaData) BigDecimal(java.math.BigDecimal) SqlNode(org.apache.calcite.sql.SqlNode) MycatTransientSQLTableScan(io.mycat.calcite.table.MycatTransientSQLTableScan) RexNode(org.apache.calcite.rex.RexNode) Duration(java.time.Duration) PlanImplementor(io.mycat.calcite.plan.PlanImplementor) MySQLErrorCode(io.mycat.beans.mysql.MySQLErrorCode) EnumerableRel(org.apache.calcite.adapter.enumerable.EnumerableRel) MycatMergeSort(io.mycat.calcite.physical.MycatMergeSort) PlanImpl(io.mycat.calcite.spm.PlanImpl) CopyMycatRowMetaData(io.mycat.beans.mycat.CopyMycatRowMetaData) Logger(org.slf4j.Logger) SqlTypeName(org.apache.calcite.sql.type.SqlTypeName) io.mycat.calcite(io.mycat.calcite) ByteString(org.apache.calcite.avatica.util.ByteString) MySQLType(io.mycat.beans.mysql.MySQLType) MycatView(io.mycat.calcite.logical.MycatView) Timestamp(java.sql.Timestamp) Expressions(org.apache.calcite.linq4j.tree.Expressions) MycatViewDataNodeMapping(io.mycat.calcite.logical.MycatViewDataNodeMapping) RelNode(org.apache.calcite.rel.RelNode) VertxUtil(io.mycat.util.VertxUtil) Future(io.vertx.core.Future) MycatSQLTableLookup(io.mycat.calcite.physical.MycatSQLTableLookup) MycatUpdateRel(io.mycat.calcite.physical.MycatUpdateRel) MycatInsertRel(io.mycat.calcite.physical.MycatInsertRel) LocalDate(java.time.LocalDate) ClassDeclaration(org.apache.calcite.linq4j.tree.ClassDeclaration) SqlString(org.apache.calcite.sql.util.SqlString) NotNull(org.jetbrains.annotations.NotNull) Plan(io.mycat.calcite.spm.Plan) MycatTransientSQLTableScan(io.mycat.calcite.table.MycatTransientSQLTableScan) RelShuttleImpl(org.apache.calcite.rel.RelShuttleImpl) ByteString(org.apache.calcite.avatica.util.ByteString) SqlString(org.apache.calcite.sql.util.SqlString) CopyMycatRowMetaData(io.mycat.beans.mycat.CopyMycatRowMetaData) MycatSQLTableLookup(io.mycat.calcite.physical.MycatSQLTableLookup) MycatView(io.mycat.calcite.logical.MycatView) ClassDeclaration(org.apache.calcite.linq4j.tree.ClassDeclaration) RelNode(org.apache.calcite.rel.RelNode) CalciteRowMetaData(io.mycat.calcite.resultset.CalciteRowMetaData) SneakyThrows(lombok.SneakyThrows) NotNull(org.jetbrains.annotations.NotNull)

Example 29 with MycatView

use of io.mycat.calcite.logical.MycatView in project Mycat2 by MyCATApache.

the class MycatAggDistinctRule method onMatch.

@Override
public void onMatch(RelOptRuleCall call) {
    Aggregate topAggregate = call.rel(0);
    MycatView mycatView = call.rel(2);
    RelHint lastAggHint = HintTools.getLastPushAggHint(topAggregate.getHints());
    if (lastAggHint != null) {
        if ("push_down_agg_distinct".equalsIgnoreCase(lastAggHint.hintName)) {
            if (topAggregate.getAggCallList().size() == 1 && topAggregate.getGroupSet().isEmpty()) {
                List<AggregateCall> aggCallList = topAggregate.getAggCallList();
                if (aggCallList.size() == 1) {
                    AggregateCall aggregateCall = aggCallList.get(0);
                    if (aggregateCall.getAggregation().kind == SqlKind.COUNT) {
                        Aggregate distinctAgg = call.rel(1);
                        if (distinctAgg.getAggCallList().isEmpty() && !distinctAgg.getGroupSet().isEmpty()) {
                            opt(call, topAggregate, mycatView);
                            return;
                        }
                    }
                }
            }
            Aggregate aggregate = topAggregate;
            MycatView input = mycatView;
            SQLRBORewriter.aggregate(input, LocalAggregate.create(aggregate, input)).ifPresent(new Consumer<RelNode>() {

                @Override
                public void accept(RelNode res) {
                    call.transformTo(normalize(res));
                }
            });
            return;
        }
    }
    if (topAggregate.getAggCallList().isEmpty() && topAggregate.getGroupSets().size() == 1) {
        RelMetadataQuery metadataQuery = call.getMetadataQuery();
        if (metadataQuery.areColumnsUnique(mycatView, topAggregate.getGroupSet())) {
            opt(call, topAggregate, mycatView);
            return;
        }
    }
}
Also used : AggregateCall(org.apache.calcite.rel.core.AggregateCall) RelMetadataQuery(org.apache.calcite.rel.metadata.RelMetadataQuery) MycatView(io.mycat.calcite.logical.MycatView) RelNode(org.apache.calcite.rel.RelNode) Aggregate(org.apache.calcite.rel.core.Aggregate) LocalAggregate(io.mycat.calcite.localrel.LocalAggregate) RelHint(org.apache.calcite.rel.hint.RelHint)

Aggregations

MycatView (io.mycat.calcite.logical.MycatView)29 RelNode (org.apache.calcite.rel.RelNode)21 RexNode (org.apache.calcite.rex.RexNode)9 RelBuilder (org.apache.calcite.tools.RelBuilder)8 RelOptCluster (org.apache.calcite.plan.RelOptCluster)7 RelHint (org.apache.calcite.rel.hint.RelHint)7 RelMetadataQuery (org.apache.calcite.rel.metadata.RelMetadataQuery)7 NotNull (org.jetbrains.annotations.NotNull)7 MycatSQLTableLookup (io.mycat.calcite.physical.MycatSQLTableLookup)6 Collectors (java.util.stream.Collectors)6 ImmutableList (com.google.common.collect.ImmutableList)5 RelCollation (org.apache.calcite.rel.RelCollation)5 RelShuttleImpl (org.apache.calcite.rel.RelShuttleImpl)5 RexBuilder (org.apache.calcite.rex.RexBuilder)5 MycatProject (io.mycat.calcite.physical.MycatProject)4 Join (org.apache.calcite.rel.core.Join)4 JoinRelType (org.apache.calcite.rel.core.JoinRelType)4 RelDataType (org.apache.calcite.rel.type.RelDataType)4 SqlString (org.apache.calcite.sql.util.SqlString)4 io.mycat (io.mycat)3