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 2021/12/27 06:22:34 UTC
[GitHub] [shardingsphere] RaigorJiang opened a new issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001436789
> > @CrackerSuperior There is not necessary to have the algorithm name in the second case, right?
>
> In other words, is it a disposable item?
No, it's actually similar to the syntax of autoTable. An algorithm is automatically created, and the name is automatically generated.
--
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] CrackerSuperior commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001398606
> @CrackerSuperior There is not necessary to have the algorithm name in the second case, right?
In other words, is it a disposable item?
--
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] CrackerSuperior commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001440146
> > > @CrackerSuperior There is not necessary to have the algorithm name in the second case, right?
> >
> >
> > In other words, is it a disposable item?
>
> No, it's actually similar to the syntax of autoTable. An algorithm is automatically created, and the name is automatically generated.
I want to try this, but it may take a long time for me to do it. Is this grammar urgent?
--
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] CrackerSuperior commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001366841
If so, where should the name of the algorithm be specified?
--
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 closed issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340
--
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] CrackerSuperior commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001444044
> > I want to try this, but it may take a long time for me to do it. Is this grammar urgent?
>
> It's a bit urgent, can I give you another issue?
Mainly because there is not much free time suitable for development every day. Helplessly.
:)
--
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] CrackerSuperior commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
CrackerSuperior commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001442497
> > I want to try this, but it may take a long time for me to do it. Is this grammar urgent?
>
> It's a bit urgent, can I give you another issue?
Haha, it's okay
--
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] tristaZero commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001397686
@CrackerSuperior There is not necessary to have the algorithm name in the second case, right?
--
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] RaigorJiang commented on issue #14340: [DistSQL] Optimize the syntax of `CREATE SHARDING TABLE RULE`.
Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14340:
URL: https://github.com/apache/shardingsphere/issues/14340#issuecomment-1001441927
> I want to try this, but it may take a long time for me to do it. Is this grammar urgent?
It's a bit urgent, can I give you another issue?
--
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