You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "hongbofan (via GitHub)" <gi...@apache.org> on 2024/09/12 04:07:32 UTC
[I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
hongbofan opened a new issue, #32832:
URL: https://github.com/apache/shardingsphere/issues/32832
## Question
first put the jar to /lib
then
CREATE SHARDING TABLE RULE test_table(
STORAGE_UNITS(ds0),
SHARDING_COLUMNS=product_source,creation_date,
TYPE(NAME="SOURCE_DATE_COMPLEX",PROPERTIES("defTable"="test_table","sources"="mall,customer","strategy"="COMPLEX","algorithmClassName"="com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm")),
KEY_GENERATE_STRATEGY(COLUMN=media_id,TYPE(NAME="snowflake"))
);
'SOURCE_DATE_COMPLEX' is SourceDateComplexShardingAlgorithm’s type
'com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm' is my tableAlgorithm
how to write the distSql right?
**For English only**, other languages will not accept.
Before asking a question, make sure you have:
- Googled your question.
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2348064676
> > @hongbofan If you do not want to add the SPI Services file, you can also specify the full path of the custom algorithm with `CLASS BASED` type. The following is an example
> > ```sql
> > CREATE SHARDING TABLE RULE t_order (
> > DATANODES("ds_${0..2}.t_order_${0..3}"),
> > DATABASE_STRATEGY(TYPE="standard",
> > SHARDING_COLUMN=order_id,
> > SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
> > PROPERTIES(
> > "strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
> > "mod-value-length"=5,"mod-count"=3)
> > ))),
> > TABLE_STRATEGY(TYPE="standard",
> > SHARDING_COLUMN=order_id,
> > SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
> > PROPERTIES(
> > "strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
> > "mod-value-length"=5,"mod-count"=4)
> > )))
> > );
> > ```
>
> this way i create sharding algorithm,
>
> CREATE SHARDING ALGORITHM source_date_complex ( TYPE(NAME=CLASS_BASED,PROPERTIES("defTable"="o2pcm_multimedia","sources"="mall,customer","strategy"="COMPLEX","algorithmClassName"="com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm")) ); get a error message You have an error in your SQL syntax: no viable alternative at input ‘CREATESHARDING’ near ‘[@2,47:54=‘SHARDING’,<864>,1:47]’ at line 1
Please use `CREATE SHARDING TABLE RULE`, there is no syntax of `CREATE SHARDING ALGORITHM` right now.
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #32832: proxy write 'CREATE SHARDING TABLE RULE'
URL: https://github.com/apache/shardingsphere/issues/32832
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2347971260
@hongbofan
If you do not want to add the SPI Services file, you can also specify the full path of the custom algorithm with `CLASS BASED` type. The following is an example
```sql
CREATE SHARDING TABLE RULE t_order (
DATANODES("ds_${0..2}.t_order_${0..3}"),
DATABASE_STRATEGY(TYPE="standard",
SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
PROPERTIES(
"strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
"mod-value-length"=5,"mod-count"=3)
))),
TABLE_STRATEGY(TYPE="standard",
SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
PROPERTIES(
"strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
"mod-value-length"=5,"mod-count"=4)
)))
);
```
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "hongbofan (via GitHub)" <gi...@apache.org>.
hongbofan commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2347981033
> @hongbofan If you want to specify a custom algorithm type "SOURCE_DATE_COMPLEX" in TYPE NAME, you need to make sure your class has been defined in SPI service, refer to `ComplexInlineShardingAlgorithm`
>
> https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
unpack my jar
get two folders
com/qx/agg/client/sharding/SourceDateComplexShardingAlgorithm.class
META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
spi.ShardingAlgorithm's context is
com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2348064017
> unpack my jar get two folders com/qx/agg/client/sharding/SourceDateComplexShardingAlgorithm.class META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
>
> spi.ShardingAlgorithm's context is com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm
It looks correct. Note that this jar needs to be placed under lib before Proxy is started. Next, you need to find the problem locally.
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2375150625
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2347968450
@hongbofan
If you want to specify a custom algorithm type "SOURCE_DATE_COMPLEX" in TYPE NAME, you need to make sure your class has been defined in SPI service, refer to `ComplexInlineShardingAlgorithm`
https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
--
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
Re: [I] proxy write 'CREATE SHARDING TABLE RULE' [shardingsphere]
Posted by "hongbofan (via GitHub)" <gi...@apache.org>.
hongbofan commented on issue #32832:
URL: https://github.com/apache/shardingsphere/issues/32832#issuecomment-2347988674
> @hongbofan If you do not want to add the SPI Services file, you can also specify the full path of the custom algorithm with `CLASS BASED` type. The following is an example
>
> ```sql
> CREATE SHARDING TABLE RULE t_order (
> DATANODES("ds_${0..2}.t_order_${0..3}"),
> DATABASE_STRATEGY(TYPE="standard",
> SHARDING_COLUMN=order_id,
> SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
> PROPERTIES(
> "strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
> "mod-value-length"=5,"mod-count"=3)
> ))),
> TABLE_STRATEGY(TYPE="standard",
> SHARDING_COLUMN=order_id,
> SHARDING_ALGORITHM(TYPE(NAME="CLASS_BASED",
> PROPERTIES(
> "strategy"="standard", "algorithmClassName"="com.sphereex.example.fixture.CustomShardingAlgorithm",
> "mod-value-length"=5,"mod-count"=4)
> )))
> );
> ```
this way i create sharding algorithm,
CREATE SHARDING ALGORITHM source_date_complex (
TYPE(NAME=CLASS_BASED,PROPERTIES("defTable"="o2pcm_multimedia","sources"="mall,customer","strategy"="COMPLEX","algorithmClassName"="com.qx.agg.client.sharding.SourceDateComplexShardingAlgorithm"))
);
get a error message
You have an error in your SQL syntax: no viable alternative at input ‘CREATESHARDING’ near ‘[@2,47:54=‘SHARDING’,<864>,1:47]’ at line 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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org