-
Notifications
You must be signed in to change notification settings - Fork 57
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
Improve RowMetadata for presence/absence check of columns #58
Conversation
Thanks a lot for your pull request. Typically, we start a discussion on these proposals whether we like the idea or whether we can solve the use-case in a different approach. I'd like to hear the opinion of the rest of the people involved in R2DBC what they think about my proposal. If you have time and if it's possible for you, please join our weekly call (Fridays, see http://r2dbc.io/resources/ for details) so we can discuss the proposal together. Regarding the call: Due to DST adjustment, the time for the call in the US is one hour later, so 7:30AM PT (USA Pacific)/10:30AM ET (USA Eastern)/3:30PM CET (Central European). |
@mp911de I am new to this open source contribution model. Thanks for sharing the call details, I will try to join this. |
Welcome to our community, great to see you engaging with open source. |
@mp911de Are we still waiting for the feedback from others on this, or if you have any other suggestions, please let me know so I can implement those changes and apply to other modules. |
Waiting on @nebhale's input on that one. |
r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/MockRowMetadata.java
Outdated
Show resolved
Hide resolved
@nbenjamin Care to squash your commits to a single one and force-push? |
r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/MockRowMetadata.java
Outdated
Show resolved
Hide resolved
822d48b
to
cfc6b02
Compare
@mp911de squashed my commits, ready for merge. |
After reiterating on that topic, I wonder whether we should rather use With columns, we have a distinct column order that does not depend on a
Reducing the contract to Furthermore, we expect that So there are two two to do/discuss:
|
cfc6b02
to
845ca77
Compare
@mp911de yes it makes sense to use |
r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/MockRowMetadata.java
Outdated
Show resolved
Hide resolved
845ca77
to
aaebf6b
Compare
@mp911de incorporated the changes, please let me know if any changes required |
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.
Looks good for a merge. I would like to await tomorrow's call before merging this one to mention that we're going to merge a breaking change so driver devs can prepare for this change.
* | ||
* @return the column names. | ||
*/ | ||
Collection<String> getColumnNames(); |
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.
This new method and io.r2dbc.spi.ColumnMetadata.getName()
should explicitly describe whether they return real column names or their aliases in Javadoc, because JDBC has different methods for these purposes.
See also more detailed description in
r2dbc/r2dbc-h2#73 (comment)
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.
Thanks, @katzyn for bringing this up, I have updated the javadoc.
Replace Stream with forEach replace foreach with for loop remove unused import change to Collection Change to LinkedHashSet update jave doc
aaebf6b
to
cbf6b24
Compare
BTW, at least some databases may return duplicate column aliases (names). For example SELECT 1 A, 2 A; returns
in PostgreSQL and
in H2. Perhaps such situation should be handled somehow too. |
You're right, only indices are unique. Names, as you already mentioned, can occur multiple times. We do not want to grow to multimaps or the like. That being said, accessing a column by name ( |
But proposed implementation returns a Some |
I think that size of the returned collection should be equal to number of columns. |
Of course, R2DBC is not a JDBC, but JDBC specification exactly describes this situation for
It's more reasonable to declare and implement the same behavior for R2DBC. |
The proposal started with a Thanks also for the JDBC reference. I think this is a valuable addition to |
@nbenjamin I'll take this PR from here. No need to add further changes. |
sure @mp911de |
@mp911de I have created initial PR for #56. Please let me know if any changes required