apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.89k stars 6.73k forks source link

org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.getOrderValuesCaseSensitiveFromTables #33325

Open WindShadowTrace opened 2 days ago

WindShadowTrace commented 2 days ago

version: springboot + postgresql + shardingsphere5.3

dataSources:
    db_0:
        dataSourceClassName: com.zaxxer.hikari.HikariDataSource
        driverClassName: org.postgresql.Driver
        url: jdbc:postgresql://xx:5432/bss_center?currentSchema=qh_bsscenter_0971&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
        username: qh_xx
        password: qh_xx
    db_1:
        dataSourceClassName: com.zaxxer.hikari.HikariDataSource
        driverClassName: org.postgresql.Driver
        url: jdbc:postgresql://xx:5432/bss_center?currentSchema=qh_bsscenter_999&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
        username: qh_xx
        password: qh_xx
rules:
- !SHARDING
    tables:
        tb_eshop_order_oao_base: 
            actualDataNodes: db_$->{0..1}.tb_eshop_order_oao_base_$->{0..2}  
            databaseStrategy:
                standard:  
                    shardingColumn: fdb_city_code   
                    shardingAlgorithmName: his_city_code_sharding
            tableStrategy:
                standard:  
                    shardingColumn: order_number   
                    shardingAlgorithmName: his_ordernumber_sharding
    shardingAlgorithms:  
        his_city_code_sharding: 
            type: PRECISE_CITY_CODE_BASED
        his_ordernumber_sharding:
            type: PRECISE_ORDER_ORDERNUMBER_BASED
        defaule_sharding:
            type: PRECISE_DEFAULT_BASED
    keyGenerators:  
        snowflake:
            type: SNOWFLAKE
props:
    sql-show: true  

desc: When performing an order by sorting query on the shard table, the following error is reported. When looking at the code, it is found that for PostgreSQL type databases, the default schema is public, and data is obtained in public based on the shard table name. However, schema.public

There's nothing in it, is there any special configuration to be made for the shard table

图片

Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.getOrderValuesCaseSensitiveFromTables(OrderByValue.java:74) at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.getOrderValuesCaseSensitive(OrderByValue.java:64) at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.(OrderByValue.java:58) at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByStreamMergedResult.orderResultSetsToQueue(OrderByStreamMergedResult.java:56) at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByStreamMergedResult.(OrderByStreamMergedResult.java:50) at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.build(ShardingDQLResultMerger.java:100) at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.merge(ShardingDQLResultMerger.java:71) at org.apache.shardingsphere.infra.merg

WindShadowTrace commented 2 days ago

图片

terrymanu commented 1 day ago

What is the SQL and table definition?