-
Notifications
You must be signed in to change notification settings - Fork 356
GH-821 Add support for specifying ORDER BY null handling for supported dialects #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
I left a couple of comments. Just small stuff.
...ata-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlGeneratorUnitTests.java
Outdated
Show resolved
Hide resolved
...ata-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlGeneratorUnitTests.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/springframework/data/jdbc/core/JdbcAggregateTemplateIntegrationTests.java
Show resolved
Hide resolved
...lational/src/main/java/org/springframework/data/relational/core/dialect/AbstractDialect.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupport.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupport.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupported.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupported.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupported.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/data/relational/core/dialect/OrderByOptionsSupported.java
Outdated
Show resolved
Hide resolved
* @author Chirag Tailor | ||
*/ | ||
public interface OrderByOptionsSupport { | ||
String resolve(@Nullable Sort.Direction direction, Sort.NullHandling nullHandling); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think this function lacks documentation. It is not clear from the first glance, ( at leas for me :) ) what exactly resolve function does. Maybe we can add javadoc upon it? @ctailor2 Chirag, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed @mikhail2048, it wasn't very clear and I think that is largely because the two related but distinct concepts of Sort.Direction
and Sort.NullHandling
shouldn't be coupled together here. I moved the direction handling back out and and repurposed this interface to be for Sort.NullHandling
only which hopefully makes the code more clear. I also added some more javadocs. Could you review my latest changes to see if these updates improve upon this?
Move ORDER BY direction evaluation back into OrderByClauseVisitor.
This makes the implementation more explicit and resilient to possible upstream code changes.
…s conform than do not.
Thanks. That's polished and merged. |
This adds support for specifying how null values should be handled when ordering query results, via the
NULLS FIRST
andNULLS LAST
options, for stores conforming to the SQL standard.Dialects for which null handling support was added:
Dialects with no current support for null handling:
Closes #821