fyeeme opened a new issue, #33660:
URL: https://github.com/apache/shardingsphere/issues/33660

   ## Sharding  not support ZoneDateTime
   
   
   ### Which version of ShardingSphere did you use?
   
   5.5.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC 
   
   ### Expected behavior
   
   zoneDateTime can be parsed correctly
   
   ```
   Caused by: java.lang.ClassCastException: class java.time.LocalDateTime 
cannot be cast to class java.time.ZonedDateTime (java.time.LocalDateTime and 
java.time.ZonedDateTime are in module java.base of loader 'bootstrap')
        at 
org.apache.ibatis.type.ZonedDateTimeTypeHandler.getNullableResult(ZonedDateTimeTypeHandler.java:39)
        at 
org.apache.ibatis.type.ZonedDateTimeTypeHandler.getNullableResult(ZonedDateTimeTypeHandler.java:29)
        at 
org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:86)
        ... 157 more
   ```
   
   ### Actual behavior
   
   The field was parsed as LocalDateTime, which subsequently caused a 
conversion exception.
   
   ### Reason analyze (If you can)
   
   <img width="875" alt="image" 
src="https://github.com/user-attachments/assets/047b5a4a-7a2c-4f1f-abec-6687029a6b42";>
   should be 
   
   ```java
    return resultSet.getObject(columnIndex, type);
   ```
   
   <img width="1600" alt="image" 
src="https://github.com/user-attachments/assets/30749f30-af14-4e82-a7df-3d9f804fb43d";>
   
   The type-specified resultSet.getObject supports parsing ZonedDateTime. 
However, in  
`org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult#getValue`,
 the method’s last line calls return resultSet.getObject(columnIndex); without 
specifying a type, resulting in ZonedDateTime parsing not being applied.
   
   As a result, this method defaults to parsing database fields with dateTime 
types as LocalDateTime.
   


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

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to