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

[优化]PartitionByMod路由函数支持string参数 #2619

Closed
funnyAnt opened this issue Oct 25, 2020 · 0 comments
Closed

[优化]PartitionByMod路由函数支持string参数 #2619

funnyAnt opened this issue Oct 25, 2020 · 0 comments

Comments

@funnyAnt
Copy link
Collaborator

问题

目前PartitionByMod传参仅仅支持int类型参数,string参数会报IllegalArgumentException异常。但是社区群里面反馈需要支持string类型

方案

string类型的参数,转换成其hashcode的绝对值,然后再计算hahs,形如:

int value = Math.abs((columnValue).hashCode());
return value % count;

junwen12221 added a commit that referenced this issue Oct 26, 2020
#2619 PartitionByMod路由函数支持string参数
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant