You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/23 08:25:15 UTC

[GitHub] [shardingsphere] peilinqian opened a new issue, #22359: The select syntax of ‘natural join’ doesn't supported;

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #22359: The select syntax of ‘natural join’ doesn't supported;

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22359:
URL: https://github.com/apache/shardingsphere/issues/22359#issuecomment-1324734553

   @peilinqian Can you provide some description about natural join? If we don't know its function, we can't implement it.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] yx9o closed issue #22359: The select syntax of ‘natural join’ doesn't support;

Posted by GitBox <gi...@apache.org>.
yx9o closed issue #22359: The select syntax of ‘natural join’ doesn't support;
URL: https://github.com/apache/shardingsphere/issues/22359


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] peilinqian commented on issue #22359: The select syntax of ‘natural join’ doesn't support;

Posted by GitBox <gi...@apache.org>.
peilinqian commented on issue #22359:
URL: https://github.com/apache/shardingsphere/issues/22359#issuecomment-1348108683

   **version**
   ```
   we find java version: java8, full_version=1.8.0_282, full_path=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/bin/java
   ShardingSphere-5.2.2-SNAPSHOT
   Commit ID: dirty-631fdf40f87223e176abe5c851a51b3287b4d6de
   Commit Message: Fix wrong decide result when execute same sharding condition subquery with sql federation (https://github.com/apache/shardingsphere/pull/22754)
   Branch: https://github.com/apache/shardingsphere/commit/631fdf40f87223e176abe5c851a51b3287b4d6de
   Build time: 2022-12-12T10:48:40+0800
   ```
   **result :pass**
   ```
   test_db=> 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.0 | init   |           1 | test   |  100001 |          1 |        1
        1000 |      10 | 2017-07-08 00:00:00.0 | init   |           1 | test   |  100002 |          1 |        1
        1001 |      10 | 2017-07-08 00:00:00.0 | init   |           2 | test   |  100101 |          2 |        1
        1001 |      10 | 2017-07-08 00:00:00.0 | init   |           2 | test   |  100102 |          2 |        1
   (4 rows)
   ```
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] wsm12138 commented on issue #22359: The select syntax of ‘natural join’ doesn't support;

Posted by GitBox <gi...@apache.org>.
wsm12138 commented on issue #22359:
URL: https://github.com/apache/shardingsphere/issues/22359#issuecomment-1328862632

   32cfedba769e156e4109d6bfa2f07a6c9d30edbe
   
   <img width="1110" alt="image" src="https://user-images.githubusercontent.com/86462784/204257183-ca73c196-ff06-4ff7-9e89-81c22d782b63.png">
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #22359: The select syntax of ‘natural join’ doesn't supported;

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #22359:
URL: https://github.com/apache/shardingsphere/issues/22359#issuecomment-1324702784

   According to openGauss document——https://docs.opengauss.org/zh/docs/3.0.0/docs/BriefTutorial/JOIN.html, it only support five join type: CROSS JOIN, INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN and FULL OUTER JOIN.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] peilinqian commented on issue #22359: The select syntax of ‘natural join’ doesn't supported;

Posted by GitBox <gi...@apache.org>.
peilinqian commented on issue #22359:
URL: https://github.com/apache/shardingsphere/issues/22359#issuecomment-1324730815

   > According to openGauss document——https://docs.opengauss.org/zh/docs/3.0.0/docs/BriefTutorial/JOIN.html, it only support five join type: CROSS JOIN, INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN and FULL OUTER JOIN.
   
   **nature is front of  join_type** 
   https://docs.opengauss.org/zh/docs/3.0.0/docs/Developerguide/SELECT.html
   
   ![image](https://user-images.githubusercontent.com/97432411/203505952-728013b9-09e4-460e-bb70-d4705dceb78c.png)
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org