Case Insensitive Map for getting Column Index#1572
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
The v2 behavior is inconsistent. It should also return lower-cased column names just like v3. |
|
Thanks for turning this into a PR. I see what you mean now. I found this in the JDBC ResultSet spec:
So I definitely agree we should do this. Do you foresee any problems if we implement it with We should also add a test case to verify this behavior, and add to the javadocs for FieldMap and the Row getters to notify users that |
|
As a side note regarding the quote from the spec above, we currently will return the last matching column if multiple columns have the same name. We may consider changing that to match ResultSet as well. |
|
I have changed it according to ResultSet specs. |
Also update to commons-collections4 for generic CaseInsensitiveMap.
|
@harshit-gangal Thanks. I added the docs and test as a new commit on your branch. I decided not to use ImmutableMap after all, because you can't use the map to check for duplicates while building the map. This should be ready to merge once your company's CLA goes through. |
|
CLA is signed Comments from the review on Reviewable.io |
|
CLAs look good, thanks! |
|
Approve the pull request here https://pullapprove.com/youtube/vitess/pull-request/1572/ |
|
Reviewed 1 of 2 files at r1, 4 of 4 files at r4. Comments from Reviewable |
This is needed so that application does not have to take care of exact case of the column.
When a V2 API is called, the column can be in Uppercase or in Mixed Case.
When a V3 API is called, the column are in Lowercase.
It is hard for the application to track when to call with Exact Matching case and when to call in lowercase.
Use of CaseInsensitiveMap will help application to call in case insensitive manner.
This change is