peilinqian opened a new issue, #22359:
URL: https://github.com/apache/shardingsphere/issues/22359

   ### 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 ‘natural join’ can be excute successfully.
   
   ### Actual behavior
   The select syntax of ‘natural join’ doesn't supported;
   
   ### 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_order; 
   DROP TABLE IF EXISTS t_order_item; 
   CREATE TABLE t_order (order_id INT PRIMARY KEY, user_id INT NOT NULL, status 
VARCHAR(50) NOT NULL, merchant_id INT NOT NULL, remark VARCHAR(50) NOT NULL, 
creation_date DATE NOT NULL);
   CREATE TABLE t_order_item (item_id INT PRIMARY KEY, order_id INT NOT NULL, 
user_id INT NOT NULL, product_id INT NOT NULL, quantity INT NOT NULL, 
creation_date DATE NOT NULL);
   INSERT INTO t_order VALUES(1000, 10, 'init', 1, 'test', '2017-07-08');
   INSERT INTO t_order VALUES(1001, 10, 'init', 2, 'test', '2017-07-08');
   INSERT INTO t_order VALUES(2000, 20, 'init', 3, 'test', '2017-08-08');
   INSERT INTO t_order VALUES(2001, 20, 'init', 4, 'test', '2017-08-08');
   INSERT INTO t_order_item VALUES(100001, 1000, 10, 1, 1, '2017-07-08');
   INSERT INTO t_order_item VALUES(100002, 1000, 10, 1, 1, '2017-07-08');
   INSERT INTO t_order_item VALUES(100101, 1001, 10, 2, 1, '2017-07-08');
   INSERT INTO t_order_item VALUES(100102, 1001, 10, 2, 1, '2017-07-08');
   SELECT * FROM t_order o natural JOIN t_order_item i WHERE o.user_id = 10 
ORDER BY o.order_id, 7;
   ```
   
   **The result of ss-Proxy** 
   ```
   test_db=> SELECT * FROM t_order o natural JOIN t_order_item i WHERE 
o.user_id = 10 ORDER BY o.order_id, 7;
   ERROR:  At line 0, column 0: INNER, LEFT, RIGHT or FULL join requires a 
condition (NATURAL keyword or ON or USING clause)
   ```
   **The result of opengauss** 
   ```
   tpccdb=# SELECT * FROM t_order o natural JOIN t_order_item i WHERE o.user_id 
= 10 ORDER BY o.order_id, 7;
    order_id | user_id |    creation_date    | status | merchant_id | remark | 
item_id | product_id | quantity
   
----------+---------+---------------------+--------+-------------+--------+---------+------------+----------
        1000 |      10 | 2017-07-08 00:00:00 | init   |           1 | test   |  
100001 |          1 |        1
        1000 |      10 | 2017-07-08 00:00:00 | init   |           1 | test   |  
100002 |          1 |        1
        1001 |      10 | 2017-07-08 00:00:00 | init   |           2 | test   |  
100101 |          2 |        1
        1001 |      10 | 2017-07-08 00:00:00 | init   |           2 | test   |  
100102 |          2 |        1
   (4 rows)
   ```
   
   ### 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
     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
   ```
   
   ```
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: governance_ds
         server-lists: 7.212.123.28:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
   authority:
     users:
       - user: root@%
         password: root
       - user: sharding
         password: sharding
     privilege:
       type: ALL_PERMITTED
   rules:
   - !TRANSACTION
     defaultType: XA
     providerType: Atomikos
   props:
     sql-show: 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]

Reply via email to