Convert geo field mappers to Parametrized form#63836
Convert geo field mappers to Parametrized form#63836romseygeek merged 16 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-search (:Search/Mapping) |
| } | ||
| return null; | ||
| throw new IllegalArgumentException("Unknown strategy [" + strategyName + "]"); | ||
| } |
There was a problem hiding this comment.
This ended up catching a pre-existing bug in GeoShapeQueryTests, which was asking for TERM instead of term as a strategy, and therefore ending up falling back on null here, which was getting translated to recursive once the mapper had been parsed. Silently falling back to recursive is a bug, I think, although on backport we will need to change this to emit a warning instead, as you can't change the strategy once it has been set and so existing mappings with badly-spelled term strategies will have to stay using recursive
There was a problem hiding this comment.
Do you think this is a breaking change?
There was a problem hiding this comment.
I'd say it was a bugfix rather than a breaking change, I think?
There was a problem hiding this comment.
I opened #63975 to emit a deprecation warning for this case in 7.x
There was a problem hiding this comment.
Existing mappings sort of fix themselves, btw, so my above comment was not correct. Once a user has added a mapping with a bad strategy, it will serialize itself as recursive, so we don't need to worry about parsing mappings from previous versions.
There was a problem hiding this comment.
Yes, that is what I checked so the only change is that creating a mapping will throw an error when before it was successful.
| ? AbstractShapeGeometryFieldMapper.Defaults.IGNORE_Z_VALUE | ||
| : shapeMapper.ignoreZValue(); | ||
| boolean coerce = shapeMapper != null && shapeMapper.coerce(); | ||
| boolean ignoreZValue = shapeMapper == null || shapeMapper.ignoreZValue(); |
There was a problem hiding this comment.
Whether or not a parameter has been explicitly set is of interest only to the mapper itself, and its serialization code; the PR changes these getters on the mappers to return simple booleans.
| } | ||
| } | ||
|
|
||
| protected String[] getParseMinimalWarnings() { |
There was a problem hiding this comment.
These needed to be changed to getters, rather than just asserting in themselves, so that the checks for deprecated boost parameters didn't get confused by the additional warnings.
|
This is a big change, because unfortunately due to the class hierarchies I had to change all the geo mappers at the same time. On the plus side, these are the only remaining mappers to convert, so once this is done we can collapse FieldMapper and ParametrizedFieldMapper together and remove a lot of dead code. |
|
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
nik9000
left a comment
There was a problem hiding this comment.
Looks right to me but I left a request and a question. I genuinely don't know the answer to the question.
|
|
||
| @Override | ||
| protected void addMultiFields(ParseContext context, Geometry geometry) { | ||
|
|
There was a problem hiding this comment.
It looks like the old code had a comment that this was intentionally a noop. I think it is worth keeping that.
| CartesianPoint o = (CartesianPoint)other; | ||
| oX = o.getX(); | ||
| oY = o.getY(); | ||
| } else if (other instanceof ParsedCartesianPoint == false) { |
There was a problem hiding this comment.
We don't need to be equal to ParsedCartesianPoints?
There was a problem hiding this comment.
If we're comparing against a ParsedCartesianPoint, then the earlier instanceof CartesianPoint branch will already have matched, so this branch is never called.
|
Thanks @nik9000, I added the comments back in. |
iverase
left a comment
There was a problem hiding this comment.
LGTM, It is a nice simplification.
|
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
|
@elasticmachine update branch |
|
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
|
@elasticmachine run elasticsearch-ci/default-distro (gradle download timeout) |
|
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
|
@elasticmachine update branch |
Relates to #62988