-
Notifications
You must be signed in to change notification settings - Fork 25.6k
SQL: change the way unsupported data types fields are handled #50823
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b2b553a
Properly ignore (for the moment) the "flattened" data type, treating it
astefan 920e143
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan ba09e3e
Make the unsupported fields handling a generic one
astefan 007d6cd
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan c1809e5
Small cleanup
astefan 0e51f43
Add one more test
astefan 330557d
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan 1d1d5da
Added a way to remember the first unsupported data type in a hierarchy
astefan a9e9296
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import org.elasticsearch.common.Strings; | ||
| import org.elasticsearch.index.IndexNotFoundException; | ||
| import org.elasticsearch.index.IndexSettings; | ||
| import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper; | ||
| import org.elasticsearch.xpack.sql.SqlIllegalArgumentException; | ||
| import org.elasticsearch.xpack.sql.type.DataType; | ||
| import org.elasticsearch.xpack.sql.type.DateEsField; | ||
|
|
@@ -151,6 +152,7 @@ public boolean equals(Object obj) { | |
|
|
||
| private static final List<String> FIELD_NAMES_BLACKLIST = Arrays.asList("_size"); | ||
| private static final String UNMAPPED = "unmapped"; | ||
| private static final String FLATTENED_FIELD_SUFFIX = "_keyed"; | ||
|
|
||
| private final Client client; | ||
| private final String clusterName; | ||
|
|
@@ -493,6 +495,12 @@ private static List<EsIndex> buildIndices(String[] indexNames, String javaRegex, | |
| if (typeEntry.getKey().startsWith("_") && typeCap.getType().startsWith("_")) { | ||
| continue; | ||
| } | ||
|
|
||
| // skip the "flattened" type of field's "_keyed" subfield | ||
|
||
| if (fieldName.endsWith("." + FLATTENED_FIELD_SUFFIX) && typeEntry.getKey().equals(FlatObjectFieldMapper.CONTENT_TYPE) | ||
| && typeCap.getType().equals(FlatObjectFieldMapper.CONTENT_TYPE)) { | ||
| continue; | ||
| } | ||
|
|
||
| // compute the actual indices - if any are specified, take into account the unmapped indices | ||
| List<String> concreteIndices = null; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Unfortunately this creates a runtime issue as plugins that are not marked as extensible (such as Painless) cannot have their classes imported into a different project.
In other words the
FlatObjectFieldMapper.CONTENT_TYPEwon't be available which would result in a CNFE.As such as I would simply declare the String constant internally and use it verbatim instead of linking to it.