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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   
[6f5b985](https://github.com/apache/shardingsphere/commit/6f5b985c7616b6ec3152f1ff986fc79a86d27da9)
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Execute sql with sql federation successfully.
   
   ### Actual behavior
   
   
![image](https://github.com/apache/shardingsphere/assets/10829171/26032c08-89e7-4168-8e45-9d31c4e7b6ca)
   
   
![image](https://github.com/apache/shardingsphere/assets/10829171/da65562e-193e-4309-84dc-81d9b095641c)
   
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ```sql
   mode:                                                                        
                                                                               
     type: Cluster                                                              
                                                                               
     repository:                                                                
                                                                               
       type: ZooKeeper                                                          
                                                                               
       props:                                                                   
                                                                               
         namespace: poc_sharding                                                
                                                                              
         server-lists: 192.168.10.23:2182                                       
                                                                                
   
         retryIntervalMilliseconds: 500                                         
                                                                               
         timeToLiveSeconds: 60                                                  
                                                                               
         maxRetries: 3                                                          
                                                                               
         operationTimeoutMilliseconds: 500  
   
   sqlFederation:
     sqlFederationEnabled: true
     executionPlanCache:
       initialCapacity: 2000
       maximumSize: 65535
   
   
   
   REGISTER STORAGE UNIT ds_0 (
       
URL="jdbc:mysql://192.168.10.23:3304/sharding_db?serverTimezone=UTC&useSSL=false",
       USER="root",
       PASSWORD="sphereex",
       PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
   );
   
   REGISTER STORAGE UNIT ds_1 (
       
URL="jdbc:mysql://192.168.10.23:3305/sharding_db?serverTimezone=UTC&useSSL=false",
       USER="root",
       PASSWORD="sphereex",
       PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
   );
   
   CREATE SHARDING TABLE RULE IF NOT EXISTS t_order (
   STORAGE_UNITS(ds_0,ds_1),
   
SHARDING_COLUMN=order_id,TYPE(NAME="hash_mod",PROPERTIES("sharding-count"="4")),
   KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="UUID"))
   );
   
   DROP TABLE IF EXISTS t_order;
   CREATE TABLE t_order (
     order_id varchar(50) NOT NULL,
     user_id int NOT NULL,
     status varchar(50) DEFAULT NULL,
     PRIMARY KEY (order_id)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   
   INSERT INTO t_order(user_id, status) VALUES 
   (1, 'SUCCESS'), 
   (2, 'FAIL'), 
   (1, 'SUCCESS'), 
   (2, 'FAIL');
   
   
   SELECT (SELECT status FROM t_order WHERE status = 'FAIL' LIMIT 1) status, 
o.user_id, o.order_id FROM t_order o WHERE o.user_id = 1;
   ```
   
   Then execute following sql:
   
   ```sql
   DROP TABLE t_order;
   DROP TABLE t_order_item;
   CREATE TABLE t_order (order_id varchar(50) NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (order_id));
   INSERT INTO t_order (order_id,user_id,status,creation_date) VALUES 
(1,1,'OK','2019/1/21/16/41/8'),(2,2,'UP','2019/1/21/16/41/8'),(3,3,'OK','2019/1/22/16/41/8'),(4,4,'OK','2019/1/23/16/41/8'),(5,5,'OK','2019/1/24/16/41/8'),(6,6,'OK','2019/1/25/16/41/8');
   CREATE TABLE t_order_item (order_item_id INT NOT NULL, order_id INT NOT 
NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, 
PRIMARY KEY (order_item_id));
   INSERT INTO t_order_item (order_item_id, order_id, user_id, status, 
creation_date) values 
(1,1,1,'OK','2019/1/21/16/41/8'),(2,2,2,'UP','2019/1/21/16/41/8'),(3,3,3,'OK','2019/1/22/16/41/8'),(4,4,4,'OK','2019/1/23/16/41/8'),(5,5,5,'OK','2019/1/24/16/41/8'),(6,6,6,'OK','2019/1/25/16/41/8');
   ```
   
   The result:
   
   ```
   mysql> SELECT a.order_id, a.user_id, b.status FROM t_order a CROSS JOIN 
t_order_item b ORDER BY b.status;
   ERROR 30000 (HY000): Unknown exception: At line 0, column 0: INNER, LEFT, 
RIGHT or FULL join requires a condition (NATURAL keyword or ON or USING clause)
   mysql> SHOW SQL_FEDERATION RULE;
   
+------------------------+-------------------------------------------+----------------------------+---------------+------------+---------------------------+
   | sql_federation_enabled | execution_plan_cache                      | 
max_usage_memory_per_query | spill_enabled | spill_path | 
spill_compression_enabled |
   
+------------------------+-------------------------------------------+----------------------------+---------------+------------+---------------------------+
   | true                   | initialCapacity: 2000, maximumSize: 65535 |       
                     | false         |            | false                     |
   
+------------------------+-------------------------------------------+----------------------------+---------------+------------+---------------------------+
   1 row in set (0.14 sec)
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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