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 2020/06/22 13:08:44 UTC
[GitHub] [shardingsphere] xbkaishui opened a new issue #6166: support LocalDateTime feature
xbkaishui opened a new issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166
Since current impl is not support java8 LocalDateTime, should we add the feature to support LocalDateTime? I can try to fix this
----------------------------------------------------------------
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] jacksparrow414 commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650848440
> @jacksparrow414 this is works for 4.x version , not work for 5.x version
if it is 5.x version, you could try config like this:
```properties
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=checking-transaction-detail-order-inline
spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.type=INLINE
spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.props.algorithm.expression=ds_$->{user_id % 2}
```
I don't find something like first line in your config
----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650704577
Hi guys, can't run the 5.0.0-RC1-SNAPSHOT with jdbc-spring-boot-starter
exception is
`Caused by: java.lang.NullPointerException: Inline sharding algorithm expression cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.createClosure(InlineShardingAlgorithm.java:57)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:51)
`
I checked the master code, is this wrong or just need higher jdk ?
public final class InlineShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> {
private static final String ALGORITHM_EXPRESSION_KEY = "algorithm.expression";
private Closure<?> createClosure() {
String expression = props.getProperty(ALGORITHM_EXPRESSION_KEY);
//this is alwarys return null in jdk8
BTW, do we have local wechat group for quickly comutations?
Config as belows
`spring:
shardingsphere:
props:
executor:
size: 16
sql:
#设置sql是否展示
show: true
check:
table:
metadata:
enabled: false
rules:
sharding:
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker.id: 123
sharding-algorithms:
checking-transaction-detail-order-inline:
type: INLINE
props:
algorithm.expression: checking_transaction_detail_$->{user_id % 9}
tables:
checking-transaction-detail:
actual-data-nodes: ds-0.checking_transaction_detail_$->{0..9}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: checking-transaction-detail-order-inline
key-generate-strategy:
type: SNOWFLAKE
column: id
datasource:
common:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
names: ds-0
ds-0:
url: jdbc:`
@tuohai666 please help to check this. 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] xbkaishui commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650871828
<img width="1226" alt="屏幕快照 2020-06-28 下午10 50 21" src="https://user-images.githubusercontent.com/1477791/85967539-47be4780-b9f5-11ea-97a3-c07f94d8fa55.png">
this is debug view in myside. in the props object, algorithm and expression are separated
----------------------------------------------------------------
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] tuohai666 closed issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
tuohai666 closed issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166
----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-647885450
yes, similar with @alterhu2020, wiil try to fix and let you know.
----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650704577
Hi guys, can't run the 5.0.0-RC1-SNAPSHOT with jdbc-spring-boot-starter
exception is
`Caused by: java.lang.NullPointerException: Inline sharding algorithm expression cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.createClosure(InlineShardingAlgorithm.java:57)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:51)
`
**I checked the master code, is this wrong or just need higher jdk ?
public final class InlineShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> {
private static final String ALGORITHM_EXPRESSION_KEY = "algorithm.expression";**
private Closure<?> createClosure() {
String expression = props.getProperty(ALGORITHM_EXPRESSION_KEY);
//this is alwarys return null in jdk8
Config as belows :
```
shardingsphere:
props:
executor:
size: 16
sql:
#设置sql是否展示
show: true
check:
table:
metadata:
enabled: false
rules:
sharding:
binding-tables: checking_transaction_detail
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker:
id: 123
sharding-algorithms:
checking-transaction-detail-order-inline:
type: INLINE
props:
algorithm-expression: checking_transaction_detail_$->{user_id % 9}
tables:
checking-transaction-detail:
actual-data-nodes: ds-0.checking_transaction_detail_$->{0..9}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: checking-transaction-detail-order-inline
key-generate-strategy:
type: SNOWFLAKE
column: id
datasource:
common:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
names: ds-0
ds-0:
url: jdbc:
```
----------------------------------------------------------------
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] xbkaishui commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650704577
Hi guys, can't run the 5.0.0-RC1-SNAPSHOT with jdbc-spring-boot-starter
exception is
`Caused by: java.lang.NullPointerException: Inline sharding algorithm expression cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.createClosure(InlineShardingAlgorithm.java:57)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:51)
`
I checked the master code, is this wrong or just need higher jdk ?
public final class InlineShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> {
private static final String ALGORITHM_EXPRESSION_KEY = "algorithm.expression";
private Closure<?> createClosure() {
String expression = props.getProperty(ALGORITHM_EXPRESSION_KEY);
//this is alwarys return null in jdk8
BTW, do we have local wechat group for quickly comutations?
----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650704577
Hi guys, can't run the 5.0.0-RC1-SNAPSHOT with jdbc-spring-boot-starter
exception is
`Caused by: java.lang.NullPointerException: Inline sharding algorithm expression cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.createClosure(InlineShardingAlgorithm.java:57)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:51)
`
**I checked the master code, is this wrong or just need higher jdk ?
public final class InlineShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> {
private static final String ALGORITHM_EXPRESSION_KEY = "algorithm.expression";**
private Closure<?> createClosure() {
String expression = props.getProperty(ALGORITHM_EXPRESSION_KEY);
//this is alwarys return null in jdk8
Config as belows :
spring:
shardingsphere:
props:
executor:
size: 16
sql:
#设置sql是否展示
show: true
check:
table:
metadata:
enabled: false
rules:
sharding:
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker.id: 123
sharding-algorithms:
checking-transaction-detail-order-inline:
type: INLINE
props:
algorithm.expression: checking_transaction_detail_$->{user_id % 9}
tables:
checking-transaction-detail:
actual-data-nodes: ds-0.checking_transaction_detail_$->{0..9}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: checking-transaction-detail-order-inline
key-generate-strategy:
type: SNOWFLAKE
column: id
datasource:
common:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
names: ds-0
ds-0:
url: jdbc:
----------------------------------------------------------------
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] xbkaishui commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-647885450
yes, similar with @alterhu2020, wiil try to fixed and let you know.
----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650853500
> > @jacksparrow414 this is works for 4.x version , not work for 5.x version
>
> if it is 5.x version, you could try config like this:
>
> ```ini
> spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=checking-transaction-detail-order-inline
> spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.type=INLINE
> spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.props.algorithm.expression=ds_$->{user_id % 2}
> ```
>
> I don't find something like first line in your config
sorry just miss the spring root level, for now I just convert the properties file to yaml, it is same as your point. by the way my spring boot version is 2.1.4, is the version matters ?
----------------------------------------------------------------
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] xbkaishui commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650853500
> > @jacksparrow414 this is works for 4.x version , not work for 5.x version
>
> if it is 5.x version, you could try config like this:
>
> ```ini
> spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=checking-transaction-detail-order-inline
> spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.type=INLINE
> spring.shardingsphere.rules.sharding.sharding-algorithms.checking-transaction-detail-order-inline.props.algorithm.expression=ds_$->{user_id % 2}
> ```
>
> I don't find something like first line in your config
sorry just miss the spring root level, for now I just convert the properties file to yaml, it is same as your point.
----------------------------------------------------------------
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] xbkaishui commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650771141
@jacksparrow414 this is works for 4.x version , not work for 5.x 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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650871828
[debug view](https://user-images.githubusercontent.com/1477791/85967539-47be4780-b9f5-11ea-97a3-c07f94d8fa55.png)
this is debug view in myside. in the props object, algorithm and expression are separated
----------------------------------------------------------------
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] jacksparrow414 commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650710438
@xbkaishui you need config Inline sharding algorithm expression,like this:

----------------------------------------------------------------
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] xbkaishui edited a comment on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
xbkaishui edited a comment on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650704577
Hi guys, can't run the 5.0.0-RC1-SNAPSHOT with jdbc-spring-boot-starter
exception is
`Caused by: java.lang.NullPointerException: Inline sharding algorithm expression cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.createClosure(InlineShardingAlgorithm.java:57)
at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:51)
`
I checked the master code, is this wrong or just need higher jdk ?
public final class InlineShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>> {
private static final String ALGORITHM_EXPRESSION_KEY = "algorithm.expression";
private Closure<?> createClosure() {
String expression = props.getProperty(ALGORITHM_EXPRESSION_KEY);
//this is alwarys return null in jdk8
BTW, do we have local wechat group for quickly comutations?
Config as belows :
spring:
shardingsphere:
props:
executor:
size: 16
sql:
#设置sql是否展示
show: true
check:
table:
metadata:
enabled: false
rules:
sharding:
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker.id: 123
sharding-algorithms:
checking-transaction-detail-order-inline:
type: INLINE
props:
algorithm.expression: checking_transaction_detail_$->{user_id % 9}
tables:
checking-transaction-detail:
actual-data-nodes: ds-0.checking_transaction_detail_$->{0..9}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: checking-transaction-detail-order-inline
key-generate-strategy:
type: SNOWFLAKE
column: id
datasource:
common:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
names: ds-0
ds-0:
url: jdbc:
@tuohai666 please help to check this. 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] tuohai666 commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
tuohai666 commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-647550370
Hi @xbkaishui,
@alterhu2020 mentioned **LocalDate, LocalTime, LocalDateTime** in https://github.com/apache/shardingsphere/issues/5203 .
Can you check whether it is the same problem in that issue?
I'am glad that you want to fix this, I can review the pr for you.
----------------------------------------------------------------
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] jacksparrow414 commented on issue #6166: support LocalDateTime feature
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #6166:
URL: https://github.com/apache/shardingsphere/issues/6166#issuecomment-650860744
@xbkaishui it should not version matters,it just config wrong.cause source code

----------------------------------------------------------------
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