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


   Currently, when using the preview statement to view the routing results of 
the federation statement, it does not return the actual statement executed.
   
   For example, if the following statement is executed, the sql that is 
actually executed is not `t_order` and `t_order_item`, but an actual table.
   
   ```sql
   mysql> PREVIEW SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id  WHERE o.order_id = 1;
   
+------------------+----------------------------------------------------------------------------------------------------+
   | data_source_name | sql                                                     
                                           |
   
+------------------+----------------------------------------------------------------------------------------------------+
   | ds_0             | SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id  WHERE o.order_id = 1 |
   | ds_1             | SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id  WHERE o.order_id = 1 |
   
+------------------+----------------------------------------------------------------------------------------------------+
   ```
   The correct result should be:
   
   ```sql
   mysql> PREVIEW SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id  WHERE o.order_id = 1;
   
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
   | data_source_name | sql                                                     
                                                                                
|
   
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
   | ds_0             | SELECT * FROM `t_order_1` WHERE `order_id` = 1 |
   | ds_1             | SELECT * FROM `t_order_1` WHERE `order_id` = 1 |
   | ds_0             | SELECT * FROM `t_order_item_0` UNION ALL SELECT * FROM 
`t_order_item_1`                                                                
 |
   | ds_1             | SELECT * FROM `t_order_item_0` UNION ALL SELECT * FROM 
`t_order_item_1`                                                                
 |
   
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
   ```
   


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