Issue 1:
org.apache.shardingsphere.core.optimize.sharding.segment.select.pagination.Pagination

private int getValue(PaginationValueSegment paginationValueSegment, List parameters) {

return paginationValueSegment instanceof ParameterMarkerPaginationValueSegment ? **(Integer)**parameters.get(((ParameterMarkerPaginationValueSegment)paginationValueSegment).getParameterIndex()) : ((NumberLiteralPaginationValueSegment)paginationValueSegment).getValue();

}

Issue 2:
Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Searched open and closed GitHub issues.

Read documentation: ShardingSphere Doc.

Please pay attention on issues you submitted, because we maybe need more details.

If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

4.0.0-RC2-SNAPSHOT(clone from dev branch)

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Sharding-JDBC

Expected behavior

sql execute success

Actual behavior

Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer

Reason analyze (If you can)

my code below:

public List findUsersByPageIntType(Integer begin, Integer end){

String sql = "select id,name,age,email from user limit ?,? ";

Object[] params = new Object[] {begin, end};

List userList = jdbcTemplate.query(sql, params, getUserMapper());

return userList;

}

public List findUsersByPageLongType(Long begin, Long end){

String sql = "select id,name,age,email from user limit ?,? ";

Object[] params = new Object[] {begin, end};

List userList = jdbcTemplate.query(sql, params, getUserMapper());

return userList;

}

first, call findUsersByPageIntType method, it's ok

but call findUsersByPageLongType method there was an error -> Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

1.application.properties

spring.shardingsphere.datasource.names=ds0

spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource

spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.jdbc.Driver

spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://127.0.0.1:3306/ttx_util?useUnicode=true&useSSL=false&characterEncoding=utf8

spring.shardingsphere.datasource.ds0.username=test

spring.shardingsphere.datasource.ds0.password=test

spring.shardingsphere.sharding.tables.user.actual-data-nodes=ds0.user_$->{0..1}

spring.shardingsphere.sharding.tables.user.table-strategy.inline.sharding-column=erp_id

spring.shardingsphere.sharding.tables.user.table-strategy.inline.algorithm-expression=user_$->{erp_id % 2}

spring.shardingsphere.sharding.tables.user.key-generator.column=id

spring.shardingsphere.sharding.tables.user.key-generator.type=SNOWFLAKE

#是否开启SQL显示，默认值: false

spring.shardingsphere.props.sql.show=true

2.table create sql:

CREATE TABLE user_0 (

id bigint(20) NOT NULL COMMENT '主键ID',

erp_id int(11) NOT NULL COMMENT '分表erpId',

name varchar(30) DEFAULT NULL COMMENT '姓名',

age int(11) DEFAULT NULL COMMENT '年龄',

email varchar(50) DEFAULT NULL COMMENT '邮箱',

PRIMARY KEY (id)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE user_1 (

id bigint(20) NOT NULL COMMENT '主键ID',

erp_id int(11) NOT NULL COMMENT '分表erpId',

name varchar(30) DEFAULT NULL COMMENT '姓名',

age int(11) DEFAULT NULL COMMENT '年龄',

email varchar(50) DEFAULT NULL COMMENT '邮箱',

PRIMARY KEY (id)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Example codes for reproduce this issue (such as a github link).