peilinqian opened a new issue, #22438: URL: https://github.com/apache/shardingsphere/issues/22438
### Which version of ShardingSphere did you use? we find java version: java8, full_version=1.8.0_342, full_path=/home/peilq_sharding/bisheng-jdk1.8.0_342//bin/java ShardingSphere-5.2.2-SNAPSHOT Commit ID: dirty-753c0cee8ee6fd3db00536da55b64bc5198a3758 Commit Message: Optimize sqlFederationExecutor init logic when sqlFederationType modify dynamically (https://github.com/apache/shardingsphere/pull/22209) Branch: https://github.com/apache/shardingsphere/commit/753c0cee8ee6fd3db00536da55b64bc5198a3758 Build time: 2022-11-19T10:18:41+0800 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior The select syntax of fetch statement is executed correctly ### Actual behavior The select syntax of fetch statement is executed error ‘java.lang.NullPointerException’ ``` test_db=> --5、offset test_db=> select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 offset 3 row; ERROR: java.lang.NullPointerException test_db=> --6、fetch test_db=> select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 fetch next 3 row only; ERROR: java.lang.NullPointerException test_db=> select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 fetch first 3 rows only; ERROR: java.lang.NullPointerException test_db=> ``` ### Reason analyze (If you can) ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. ``` drop table if exists t_new_order; drop table if exists t_merchant; create table t_new_order (order_id int primary key, user_id int not null, status varchar(50) not null, merchant_id int not null, remark varchar(50), creation_date date); create table t_merchant (merchant_id int primary key, country_id int not null, merchant_name varchar(50) not null, business_code varchar(50) not null, telephone varchar(50) not null, creation_date date not null); insert into t_new_order values(1000, 10, 'init', 1, 'test', '2017-07-08'); insert into t_new_order values(1001, 10, 'init', 2, 'test', '2017-07-08'); insert into t_new_order values(2000, 20, 'init', 3, 'test', '2017-08-08'); insert into t_new_order values(2001, 20, 'init', 4, 'test', '2017-08-08'); insert into t_new_order values(1100, 11, 'init', 5, 'test', '2017-08-08'); insert into t_new_order values(1101, 11, 'init', 6, 'test', '2017-08-08'); insert into t_new_order values(2100, 21, 'init', 7, 'test', '2017-08-08'); insert into t_new_order values(2101, 21, 'init', 8, 'test', '2017-08-08'); insert into t_new_order values(1200, 12, 'init', 9, 'test', '2017-08-08'); insert into t_new_order values(1201, 12, 'init', 10, 'test', '2017-08-18'); insert into t_new_order values(2200, 22, 'init', 11, 'test', '2017-08-18'); insert into t_new_order values(2201, 22, 'init', 12, 'test', '2017-08-18'); -- insert t_merchant insert into t_merchant values(1, 86, 'tencent', '86000001', '86100000001', '2017-08-08'); insert into t_merchant values(2, 86, 'haier', '86000002', '86100000002', '2017-08-08'); insert into t_merchant values(3, 86, 'huawei', '86000003', '86100000003', '2017-08-08'); insert into t_merchant values(4, 86, 'alibaba', '86000004', '86100000004', '2017-08-08'); insert into t_merchant values(5, 86, 'lenovo', '86000005', '86100000005', '2017-08-08'); insert into t_merchant values(6, 86, 'moutai', '86000006', '86100000006', '2017-12-08'); insert into t_merchant values(7, 86, 'baidu', '86000007', '86100000007', '2017-08-08'); insert into t_merchant values(8, 86, 'xiaomi', '86000008', '86100000008', '2017-08-08'); insert into t_merchant values(9, 86, 'vivo', '86000009', '86100000009', '2017-11-08'); insert into t_merchant values(10, 86, 'oppo', '86000010', '86100000010', '2017-08-08'); insert into t_merchant values(11, 1, 'google', '01000011', '01100000011', '2017-08-08'); set dist variable sql_federation_type="ADVANCED"; show dist variable where name=sql_federation_type; --5、offset select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 offset 3 row; --6、fetch select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 fetch next 3 row only; select * from t_new_order o inner join t_merchant m using(merchant_id) where o.user_id > 10 and o.user_id < 15 order by o.order_id, 7 fetch first 3 rows only; ``` ### Example codes for reproduce this issue (such as a github link). ``` schemaName: test_db dataSources: ds_0: connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 260 minPoolSize: 10 password: Test@123 url: jdbc:opengauss://90.90.44.171:14000/test_db?batchMode=on username: tpccuser ds_1: connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 260 minPoolSize: 10 password: Test@123 url: jdbc:opengauss://90.90.44.171:15000/test_db?batchMode=on username: tpccuser rules: - !SHARDING tables: t_user: actualDataNodes: ds_0.t_user t_product: actualDataNodes: ds_0.t_product t_merchant: actualDataNodes: ds_1.t_merchant t_product_detail: actualDataNodes: ds_1.t_product_detail t_order: actualDataNodes: ds_${0..1}.t_order databaseStrategy: standard: shardingColumn: user_id shardingAlgorithmName: database_inline t_order_item: actualDataNodes: ds_${0..1}.t_order_item databaseStrategy: standard: shardingColumn: user_id shardingAlgorithmName: database_inline t_order_item1: actualDataNodes: ds_${0..1}.t_order_item1 databaseStrategy: standard: shardingColumn: user_id shardingAlgorithmName: database_inline t_new_order: actualDataNodes: ds_${0..1}.t_new_order_${0..1} databaseStrategy: standard: shardingAlgorithmName: database_inline shardingColumn: user_id tableStrategy: standard: shardingColumn: order_id shardingAlgorithmName: table_inline t_group: actualDataNodes: ds_${0..1}.t_group_${0..1} databaseStrategy: standard: shardingAlgorithmName: database_group_inline shardingColumn: fact1_id tableStrategy: standard: shardingColumn: fact2_id shardingAlgorithmName: table_group_inline bindingTables: - t_order,t_order_item broadcastTables: - t_product_category - t_country shardingAlgorithms: database_inline: type: INLINE props: algorithm-expression: ds_${user_id % 2} allow-range-query-with-inline-sharding: true table_inline: type: INLINE props: algorithm-expression: t_new_order_${order_id % 2} allow-range-query-with-inline-sharding: true database_group_inline: type: INLINE props: algorithm-expression: ds_${fact1_id % 2} allow-range-query-with-inline-sharding: true table_group_inline: type: INLINE props: algorithm-expression: t_group_${fact2_id % 2} allow-range-query-with-inline-sharding: true ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
