ShardingSphere-jdbc5.1.0使用联邦查询出现循环引用

方便更快捷的说明问题,可以按需填写(可删除)

使用环境:

springboot+mybaties

场景、问题:

使用mybaties跨库条件分页查询时,where条件和order by同时使用直接报错循环引用,

已进行操作:

这是我的配置

datasource:
  names: mydb,mydb1
  mydb:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
  mydb1:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://localhost:3306/mydb1?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
    # 配置 Druid 连接池属性
    # 数据源其他配置
    initialSize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60000
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
    # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
    #filters: stat,wall,log4j
    maxPoolPreparedStatementPerConnectionSize: 20
    useGlobalDataSourceStat: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
rules:
  sharding:
    # 表策略配置
    tables:
      # t_user 是逻辑表
      t_user:
        # 配置数据节点,这里是按月分表
        actualDataNodes: mydb1.t_user_$->{2022..2100}0$->{1..9},mydb.t_user_$->{2022..2100}1$->{0..2}
        tableStrategy:
          # 使用标准分片策略
          standard:
            # 配置分片字段
            shardingColumn: create_time
 
            shardingAlgorithmName: time-sharding-altorithm
    # 分片算法配置
    shardingAlgorithms:
      time-sharding-altorithm:
        type: CLASS_BASED
        props:
          strategy: standard
          # 分片算法类
          algorithmClassName: com.demo.module.config.sharding.TimeShardingAlgorithm
props:
  sql-federation-enabled: true
  sql-show: true

现状:

出现一个循环引用的异常
org.apache.calcite.rel.metadata.CyclicMetadataException: null
at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) ~[na:na]
at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:218) ~[calcite-core-1.27.0.jar:1.27.0]
at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:147) ~[calcite-core-1.27.0.jar:1.27.0]
at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) ~[na:na]
at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) ~[na:na]
at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:218) ~[calcite-core-1.27.0.jar:1.27.0]
at org.apache.calcite.rel.metadata.RelMdRowCount.getRowCount(RelMdRowCount.java:75) ~[calcite-core-1.27.0.jar:1.27.0]
at GeneratedMetadataHandler_RowCount.getRowCount_$(Unknown Source) ~[na:na]
at GeneratedMetadataHandler_RowCount.getRowCount(Unknown Source) ~[na:na]
at org.apache.calcite.rel.metadata.RelMetadataQuery.getRowCount(RelMetadataQuery.java:218) ~[calcite-core-1.27.0.jar:1.27.0]
at org.apache.calcite.rel.core.Project.computeSelfCost(Project.java:243) ~[calcite-core-1.27.0.jar:1.27.0]

京ICP备2021015875号