Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline strategy cannot support range sharding #4180

Closed
ghost opened this issue Feb 6, 2020 · 7 comments
Closed

Inline strategy cannot support range sharding #4180

ghost opened this issue Feb 6, 2020 · 7 comments

Comments

@ghost
Copy link

ghost commented Feb 6, 2020

sharding-jdbc version 4.0.0

sql select * from t_account where f_type = 1 and f_id >= 10000 and f_code in ("500","604","685") group by f_code;

An exception occurred during the query.

@ghost
Copy link
Author

ghost commented Feb 6, 2020

Please help me solve this problem, thank you

@KomachiSion
Copy link
Member

What's your sharding configuration?

BTW, Inline strategy only support = and in condition for sharding column. If you want to use range sharding, you should use standard strategy.

More detail see documents

@ghost
Copy link
Author

ghost commented Feb 6, 2020

config:
shardingColumn: f_id

If you have a query for the range of columns in a separate table, how will it be configured, such as f_id>= XXX

@KomachiSion
Copy link
Member

You should code a RangeShardingAlgorithm and configure it as your range algorithm.

example like : https://github.com/apache/incubator-shardingsphere-example/tree/dev/sharding-jdbc-example/sharding-example/sharding-raw-jdbc-example

use sharding-databases-range.yaml

@terrymanu
Copy link
Member

No, Inline strategy cannot support range sharding.
More details please reference document and example

@kimmking
Copy link
Member

@succeo you can use latest version and turn on this feature like this in server.yaml:

allow.range.query.with.inline.sharding: true

@lishuo5263
Copy link
Member

lishuo5263 commented May 28, 2020

@succeo you can use latest version and turn on this feature like this in server.yaml:

allow.range.query.with.inline.sharding: true

hi, KimmKing, I got same question, I fllow your way to try execute this sql (SELECT * FROM t_order WHERE order_id BETWEEN ? AND ?)

and result is :

Cause: java.lang.IllegalStateException: Inline strategy cannot support this type sharding:RangeRouteValue(columnName=order_id, tableName=t_order, valueRange=[472417022777995264‥482417022777995264])] with root cause

java.lang.IllegalStateException: Inline strategy cannot support this type sharding:RangeRouteValue(columnName=order_id, tableName=t_order, valueRange=[472417022777995264‥482417022777995264])

by the way ,my sharding-shpere jar version update to 4.1.0, How can i fix this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants