xuejmnet commented on issue #25414:
URL:
https://github.com/apache/shardingsphere/issues/25414#issuecomment-1534098277
@strongduanmu this is a sample
```java
/**
* before
* @return
*/
public boolean isSameGroupByAndOrderByItems() {
return !groupByContext.getItems().isEmpty() &&
groupByContext.getItems().equals(orderByContext.getItems());
}
/**
* after
* @return
*/
public boolean isGroupByStartsWithOrderByItems() {
if(groupByContext.getItems().isEmpty()){
return false;
}
int min = Math.min(groupByContext.getItems().size(),
orderByContext.getItems().size());
Iterator<OrderByItem> groupIterator =
groupByContext.getItems().iterator();
Iterator<OrderByItem> orderIterator =
orderByContext.getItems().iterator();
for (int i = 0; i < min; i++) {
OrderByItem groupItem = groupIterator.next();
OrderByItem orderItem = orderIterator.next();
if(!Objects.equals(groupItem,orderItem)){
return false;
}
}
return true;
}
```
isGroupByStartsWithOrderByItems better than isSameGroupByAndOrderByItems
--
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]