RaigorJiang opened a new issue #14340: URL: https://github.com/apache/shardingsphere/issues/14340
Hi community, According to the existing [RDL syntax](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/), if the user wants to use the inline expression to specify shariding table nodes, before `CREATE SHARDING TABLE RULE,` he must first execute the `CREATE SHARDING ALGORITHM` to create the necessary algorithm. For example: ```sql CREATE SHARDING ALGORITHM database_inline (TYPE(NAME=inline,PROPERTIES("algorithm-expression"="resource_${user_id % 2}"))), table_inline (TYPE(NAME=inline,PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}"))); CREATE SHARDING TABLE RULE t_order_item ( DATANODES("resource_${0..1}.t_order_item_${0..1}"), DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=user_id,SHARDING_ALGORITHM=database_inline), TABLE_STRATEGY(TYPE=standard,SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=table_inline) ); ``` If users can directly declare inline expressions in the `CREATE SHARDING TABLE RULE` statement, it will simplify the process of creating rules. For example: ```sql CREATE SHARDING TABLE RULE t_order_item ( DATANODES("resource_${0..1}.t_order_item_${0..1}"), DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME=inline,PROPERTIES("algorithm-expression"="resource_${user_id% 2}")))), TABLE_STRATEGY(TYPE=standard,SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME=inline,PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}")))) ); ``` So, I suggest optimizing the syntax of `CREATE SHARDING TABLE RULE` and `ALTER SHARDING TABLE RULE`, allowing users to use any of the above ways to define rules. -- 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]
