apache / apache/shardingsphere
The `yearIsDateType=false` not effect at ShardingSphere-Proxy + MySQL
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 38m
- Merged PRs (30d)
- 326
Description
## Bug Report
Driver: MySQL connector/j 8
Create table and init data.
```
create table test(
id int not null primary key ,
t_year year null
);
INSERT INTO pipeline_it_0.test (id, t_year) VALUES (1, 2023);
```
The `yearIsDateType=false` jdbc parameter not effect, the test code below
```
try (Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3307/sharding_db?useSSL=false&requireSSL=false&serverTimezone=UTC&useLocalSessionState=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&yearIsDateType=false", "root", "root")) {
ResultSet resultSet = connection.createStatement().executeQuery("select t_year from t_order order by order_id");
while (resultSet.next()) {
System.out.println(resultSet.getObject(1));
}
}
```
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
yearIsDateType=false effect, return `Short` of java type
### Actual behavior
yearIsDateType=false not effect
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
### Example codes for reproduce this issue (such as a github link).
Contributor guide
Research direction
Start with the provided ShardingSphere-Proxy reproduction using MySQL Connector/J 8, the year column definition, and the SELECT executed through DriverManager. Trace the value returned by ResultSet.getObject(1) and compare it with the expected Short result when yearIsDateType=false; done means the parameter affects the returned Java type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100