Skip to content
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

Make MappedFieldType responsible for providing a parser/formatter. #17546

Merged
merged 2 commits into from
Apr 7, 2016

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Apr 5, 2016

Aggregations need to perform instanceof calls on MappedFieldType instances in
order to know how they should be parsed or formatted. Instead, we should let
the field types provide a formatter/parser that can can be used.

@@ -784,6 +785,13 @@ public SmoothingModel readPhraseSuggestionSmoothingModel() throws IOException {
}

/**
* Reads a {@link ValueFormat} from the current stream.
*/
public ValueFormat readValueFormat() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test of this method in BytesStreamTests? (see comment here: #17351 (comment))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added serialization tests, but in a dedicated test in the same package as DocValeFormat so that I can assert on the value of pkg protected fields without exposing anything to the public

@colings86
Copy link
Contributor

@jpountz I left a few comments.

@jpountz jpountz force-pushed the enhancement/fieldtype_format branch from b0db200 to 3cbd49e Compare April 6, 2016 16:14
@jpountz
Copy link
Contributor Author

jpountz commented Apr 6, 2016

I pushed commits to address your comments.

@colings86
Copy link
Contributor

LGTM

jpountz added 2 commits April 7, 2016 16:57
…astic#17546

Aggregations need to perform instanceof calls on MappedFieldType instances in
order to know how they should be parsed or formatted. Instead, we should let
the field types provide a formatter/parser that can can be used.
@jpountz jpountz force-pushed the enhancement/fieldtype_format branch from 3cbd49e to c33300c Compare April 7, 2016 14:58
@jpountz jpountz merged commit c33300c into elastic:master Apr 7, 2016
nknize added a commit to nknize/elasticsearch that referenced this pull request May 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants