huanghao495430759 edited a comment on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-817283554


   Hi,this is my ideas.
   
   **Background**
   
   1. we assume the sql like:  `create table user(id,user_name,password)`
     and the query Logic SQL : ` select * from user`
   2. feature-encrypt rewrite engine : Scan all of the table columns to find 
the encrypt column from logic SQL, and generate the column token. just like 
`user.id,user.user_name,user.password`
   3. feature-sharding rewrite engine for sharding table: Scan all of the table 
name to find rewrite table name from logic SQL,and generate all of the Table 
token.
   
   **Present situation**
   feature-encrypt generate column token contain the `owner ` information and 
then it's `owner` name equals the `logic table` name, but the `owner ` doesn’t 
dependents on table sharding route unit,so the sql can not rewrite 
corrently,just like `select user.id,user.user_name,user.password from user_0`
   
   
![image](https://user-images.githubusercontent.com/34728144/114300085-20061f00-9af1-11eb-8fce-31ba08550169.png)
   
   **Current Solutions**
   
   1. Defind new structure `OwnerToken` to save the column’s owner, and 
`OwnerToken` implements `RouteUnitAware` .
   2. Defind new structure `CombinationalSQLToken` to save the collection of 
`SQLToken`. 
   3. The encrypt rewrite engine generate `OwnerToken ` and  
`SubstitutableColumnNameToken` at the same time, keep them in their generation 
order and save to `CombinationalSQLToken ` .
   
   
![image](https://user-images.githubusercontent.com/34728144/114300279-074a3900-9af2-11eb-8b3e-0e1242a4f62a.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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to