You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following error message appears when executing an SQL statement with an ORDER BY clause in Oracle: "Order by value must implement Comparable."
#33678
Open
NjuptMei opened this issue
Nov 15, 2024
· 1 comment
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
config:
actualDataNodes: ds0.dmg_kettle_conf, ds0.dmg_kettle_config_dmgtmp
logicTable: dmg_kettle_config
behavior:
when executing SQL "select * from dmg_kettle_config order by create_timstmp desc", except the ordered result, the dataTye of create_timstmp is TimeStamp With Time Zone, (doesn't support this dataType?)
Actual behavior
when executing SQL "select * from dmg_kettle_config order by create_timstmp desc", the error message "Order by value must implement Comparable." occurs
Reason analyze (If you can)
When executing query, in oracle.jdbc.driver.OracleResultSetMetaData.getColumnType, the create_timstmp dataType is 181, and mappings to code -101
and in shardingJdbc, when merging resut, it only transfer the code 93 to java.sql.Timestamp, but the code -101 convert to Object: org.apache.shardingsphere.sharding.execute.sql.execute.result.MemoryQueryResult.getRows(ResultSet resultSet)
so, when code running the order executor: org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.getOrderValues(), cause this error.
btw: Setting the following parameter: System.getProperties().setProperty("oracle.jdbc.J2EE13Compliant", "true") is ineffective.
Which version of ShardingSphere did you use?
shardingsphere Ver. shardingsphere, 5.4.1
oracle Ver. oracle12c
ojdbc Ver. ojdbc8
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
config:
actualDataNodes: ds0.dmg_kettle_conf, ds0.dmg_kettle_config_dmgtmp
logicTable: dmg_kettle_config
behavior:
when executing SQL "select * from dmg_kettle_config order by create_timstmp desc", except the ordered result, the dataTye of create_timstmp is TimeStamp With Time Zone, (doesn't support this dataType?)
Actual behavior
when executing SQL "select * from dmg_kettle_config order by create_timstmp desc", the error message "Order by value must implement Comparable." occurs
Reason analyze (If you can)
When executing query, in
oracle.jdbc.driver.OracleResultSetMetaData.getColumnType
, the create_timstmp dataType is 181, and mappings to code -101and in shardingJdbc, when merging resut, it only transfer the code 93 to java.sql.Timestamp, but the code -101 convert to Object:
org.apache.shardingsphere.sharding.execute.sql.execute.result.MemoryQueryResult.getRows(ResultSet resultSet)
so, when code running the order executor:
org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.getOrderValues()
, cause this error.btw: Setting the following parameter: System.getProperties().setProperty("oracle.jdbc.J2EE13Compliant", "true") is ineffective.
https://shardingsphere.apache.org/document/4.1.1/en/faq/#10-why-does-oracle-database-throw-order-by-value-must-implements-comparable-exception-when-using-timestamp-order-by
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
SQL "select * from dmg_kettle_config order by create_timstmp desc", create_timstmp is TimeStamp With Time Zone, (doesn't support this dataType?)
Example codes for reproduce this issue (such as a github link).
The text was updated successfully, but these errors were encountered: