You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/12 08:16:17 UTC

[GitHub] [shardingsphere] hongjun2012 opened a new issue, #22102: ShardingSphere-Proxy-5.2.1,sharding and Readwrite-splitting, order by datetime throw java.lang.ClassCastException

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   5.2.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Actual behavior
   java.lang.ClassCastException: class java.sql.Timestamp cannot be cast to class java.time.chrono.ChronoLocalDateTime (java.sql.Timestamp is in module java.sql of loader 'platform'; java.time.chrono.ChronoLocalDateTime is in module java.base of loader 'bootstrap')
   sharding_proxy  |       at java.base/java.time.LocalDateTime.compareTo(LocalDateTime.java:135)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.orderby.CompareUtil.compareTo(CompareUtil.java:54)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.compareTo(OrderByValue.java:120)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByValue.compareTo(OrderByValue.java:43)
   sharding_proxy  |       at java.base/java.util.PriorityQueue.siftUpComparable(PriorityQueue.java:647)
   sharding_proxy  |       at java.base/java.util.PriorityQueue.siftUp(PriorityQueue.java:639)
   sharding_proxy  |       at java.base/java.util.PriorityQueue.offer(PriorityQueue.java:330)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByStreamMergedResult.orderResultSetsToQueue(OrderByStreamMergedResult.java:58)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.orderby.OrderByStreamMergedResult.<init>(OrderByStreamMergedResult.java:50)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.build(ShardingDQLResultMerger.java:95)
   sharding_proxy  |       at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.merge(ShardingDQLResultMerger.java:66)
   sharding_proxy  |       at org.apache.shardingsphere.infra.merge.MergeEngine.executeMerge(MergeEngine.java:82)
   sharding_proxy  |       at org.apache.shardingsphere.infra.merge.MergeEngine.merge(MergeEngine.java:71)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.mergeQuery(DatabaseCommunicationEngine.java:174)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.processExecuteQuery(DatabaseCommunicationEngine.java:140)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:134)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:94)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
   sharding_proxy  |       at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
   sharding_proxy  |       at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   sharding_proxy  |       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   sharding_proxy  |       at java.base/java.lang.Thread.run(Thread.java:833)
   ### Reason analyze (If you can)
   mysql database field query order
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   rules:
     - !SHARDING
       tables:
         t_order:
           actualDataNodes: replica_ds_${0..1}.t_order_${0..1}
           tableStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: t_order_inline
           keyGenerateStrategy:
             column: order_id
             keyGeneratorName: snowflake
       defaultDatabaseStrategy:
         standard:
           shardingColumn: user_id
           shardingAlgorithmName: database_inline
       shardingAlgorithms:
         database_inline:
           type: INLINE
           props:
             algorithm-expression: replica_ds_${user_id % 2}
         t_order_inline:
           type: INLINE
           props:
             algorithm-expression: t_order_${order_id % 2}
         t_order_item_inline:
           type: INLINE
           props:
             algorithm-expression: t_order_item_${order_id % 2}
       keyGenerators:
         snowflake:
           type: SNOWFLAKE
     - !READWRITE_SPLITTING
       dataSources:
         replica_ds_0:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_0
         replica_ds_1:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_1
     - !DB_DISCOVERY
       dataSources:
         readwrite_ds_0:
           dataSourceNames:
             - ds_0
             - ds_1
             - ds_2
           discoveryHeartbeatName: mgr-heartbeat
           discoveryTypeName: mgr
         readwrite_ds_1:
           dataSourceNames:
             - ds_3
             - ds_4
             - ds_5
           discoveryHeartbeatName: mgr-heartbeat
           discoveryTypeName: mgr
       discoveryHeartbeats:
         mgr-heartbeat:
           props:
             keep-alive-cron: '0/5 * * * * ?'
       discoveryTypes:
         mgr:
           type: MySQL.MGR
           props:
             group-name: 558edd3c-02ec-11ea-9bb3-080027e39bd2
   ### Example codes for reproduce this issue (such as a github link).
   ### SQL: SELECT id, type, title, time, service_id, server_ip, server_host, env, remote_ip, user_agent, request_uri, method, method_class, method_name, create_by, create_time FROM t_orderORDER BY create_time DESC LIMIT 10
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on issue #22102: ShardingSphere-Proxy-5.2.1,sharding and Readwrite-splitting, order by datetime throw java.lang.ClassCastException

Posted by GitBox <gi...@apache.org>.
sandynz commented on issue #22102:
URL: https://github.com/apache/shardingsphere/issues/22102#issuecomment-1342704272

   Hi @hongjun2012 , I did a simple test on local, without readwrite-splitting, just order by datetime column, it works.
   
   Does it work if you remove readwrite-splitting configuration?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang closed issue #22102: ShardingSphere-Proxy-5.2.1,sharding and Readwrite-splitting, order by datetime throw java.lang.ClassCastException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #22102: ShardingSphere-Proxy-5.2.1,sharding and Readwrite-splitting, order by datetime throw java.lang.ClassCastException
URL: https://github.com/apache/shardingsphere/issues/22102


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #22102: ShardingSphere-Proxy-5.2.1,sharding and Readwrite-splitting, order by datetime throw java.lang.ClassCastException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #22102:
URL: https://github.com/apache/shardingsphere/issues/22102#issuecomment-1407268298

   Closed due to no response.
   If this problem persists, please reopen it or submit a new one.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org