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/01/07 01:50:32 UTC
[GitHub] [shardingsphere] authorXiao opened a new issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
authorXiao opened a new issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924
shardingsphere version is 4.0.0-RC2
shardingsphere Range Sharding Algorithm Unsupported >=;
yaml:
spring:
application:
name: demo
shardingsphere:
datasource:
names: master
master:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/rsr_battery?allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&nullNamePatternMatchesAll=true&serverTimezone=Asia/Shanghai
username: root
password: a50k*7Ch1YTGYJW4
sharding:
binding-tables: test_copy
tables:
test_copy:
actual-data-nodes: master.test_copy
table-strategy:
standard:
sharding-column: gmt_date
range-algorithm-class-name: com.demo.model.strategy.OrderProfitDetailPreciseShardingAlgorithm
precise-algorithm-class-name: com.demo.model.strategy.OrderProfitDetailPreciseShardingAlgorithm
OrderProfitDetailPreciseShardingAlgorithm.class
public class OrderProfitDetailPreciseShardingAlgorithm implements PreciseShardingAlgorithm<String>,RangeShardingAlgorithm<String> {
@Override
public String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<String> shardingValue) {
for (String tableName : availableTargetNames) {
String value = shardingValue.getValue();
String dateStr =value.split("-")[0];
String mm =value.split("-")[1];
return tableName.concat("_").concat(dateStr).concat("_").concat(mm);
}
return null;
}
@Override
public Collection<String> doSharding(Collection<String> availableTargetNames,
RangeShardingValue<String> shardingValue) {
List<String> list = new ArrayList<String>();
Range<String> left = shardingValue.getValueRange();
String lowerEndpoint = left.lowerEndpoint();
String year = lowerEndpoint.split("-")[0];
String month = lowerEndpoint.split("-")[1];
for (String targetName : availableTargetNames) {
list.add(targetName.concat("_").concat(year).concat("_").concat(month));
}
return list;
}
}
xml:
<select id="findUserByGmtDate" parameterType="String" resultType="com.demo.model.User">
SELECT t.*
FROM test_copy t
left join test_copy c on c.id=t.id
WHERE t.gmt_date>=#{date}
</select>
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] authorXiao commented on issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
authorXiao commented on issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924#issuecomment-756532706
my use updated version ,supported >=
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] authorXiao commented on issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
authorXiao commented on issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924#issuecomment-755992119
my going to update to the 4.0.x version, this shardingsphere Range Sharding Algorithm Unsupported >=
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924#issuecomment-756533170
Does that mean this issue is supposed to be closed? That way, please give this one a close.
Thanks.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924#issuecomment-755891120
Hi @authorXiao
Have you ever tried an updated version?
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] authorXiao removed a comment on issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
authorXiao removed a comment on issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924#issuecomment-755992119
my going to update to the 4.0.x version, this shardingsphere Range Sharding Algorithm Unsupported >=
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] authorXiao closed issue #8924: shardingsphere Range Sharding Algorithm Unsupported >=
Posted by GitBox <gi...@apache.org>.
authorXiao closed issue #8924:
URL: https://github.com/apache/shardingsphere/issues/8924
----------------------------------------------------------------
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:
users@infra.apache.org