axli-personal opened a new issue, #30553:
URL: https://github.com/apache/shardingsphere/issues/30553

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   ```xml
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core</artifactId>
       <version>5.3.2</version>
   </dependency>
   ```
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   Original SQL:
   
   ```sql
   select train_seats.operation_id,
          train_seats.type AS seat_type,
          COUNT(*)         AS seat_count
   from train_seats use index (train_seats_station_departure_idx)
   where train_seats.from_station_id = #{fromStationId}
     AND train_seats.dest_station_id = #{destStationId}
     AND train_seats.status = #{seatStatus}
     AND TO_DAYS(train_seats.departure_time) = TO_DAYS(#{date})
   group by train_seats.operation_id, train_seats.type
   order by train_seats.operation_id, train_seats.type
   ```
   
   After Sharding:
   
   ```sql
   select train_seats_7.operation_id,
          train_seats_7.type AS seat_type,
          COUNT(*)         AS seat_count
   from train_seats_7 use index (train_seats_station_departure_idx)
   where train_seats_7.from_station_id = ?
     AND train_seats_7.dest_station_id = ?
     AND train_seats_7.status = ?
     AND TO_DAYS(train_seats.departure_time) = TO_DAYS(?)
   group by train_seats_7.operation_id, train_seats_7.type
   order by train_seats_7.operation_id, train_seats_7.type
   ```
   
   ### Actual behavior
   
   Replace `train_seats` with `train_seats_7` in 
`TO_DAYS(train_seats.departure_time)`
   
   ### Reason analyze (If you can)
   
   `TO_DAYS` function?
   


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