-
Notifications
You must be signed in to change notification settings - Fork 25.7k
SQL: Use field caps inside DESCRIBE TABLE as well #41377
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
Thanks to elastic#34071, there is enough information in field caps to infer the table structure and thus use the same API consistently across the IndexResolver.
|
Pinging @elastic/es-search |
astefan
left a 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.
LGTM
matriv
left a 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.
LGTM. Left some minor comments.
| String name = entry.getKey(); | ||
| for (Entry<String, FieldCapabilities> type : types.entrySet()) { | ||
| // skip unmapped | ||
| if (UNMAPPED.equals(type.getKey())) { |
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.
Personal preference: I'd inverse the check and surround the whole block with this if, rather than use continue
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'm not a fan of continue but I prefer it instead of indenting a long method already wrapped...
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.
Yep, I understand, and I'm not insisting, I didn't comment at all here: https://github.com/elastic/elasticsearch/pull/41377/files/2e890c11f3283d32c6325f7d9ebb7d14b1972ec5#diff-e9f288c0280d1beafe4dc4cf86c12c7bR433 where the block is even larger as inverting the if makes it much less readable.
| return esField; | ||
| } | ||
|
|
||
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.
unnecessary whitespaces
| // make a copy of the list to be able to modify it | ||
| concreteIndices = new ArrayList<>(asList(capIndices)); | ||
| if (unmappedIndices.isEmpty() == false) { | ||
| concreteIndices.removeAll(unmappedIndices); |
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.
Maybe not so important: I would use a Set for the unmappedIndices and use contains() to speed up the removal. This way you can iterate on the String[] and create the concreteIndices list.
7277e9c to
1853ac3
Compare
Thanks to elastic#34071, there is enough information in field caps to infer the table structure and thus use the same API consistently across the IndexResolver.
Thanks to #34071, there is enough information in field caps to infer
the table structure and thus use the same API consistently across the
IndexResolver.