-
Notifications
You must be signed in to change notification settings - Fork 246
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
HSEARCH-5133 Support basic metrics aggregations #4144
Conversation
58ebd31
to
a23d9b9
Compare
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.
Nice progress 😃,
I've added some inline comments here and there. As for the ElasticsearchFieldCodec#convertFromDouble(Double value)
:
- it is probably fine for now, while we are iterating on the implementation.
- let's figure out what it means for non-numeric types
- if we don't go with doubles for the Lucene backend and it will stay only as an implementation detail for the Elasticsearch backend, we probably wouldn't need to expose it for any user customization so it can stay in the codec. otherwise maybe it'll make more sense to have something in
SearchIndexValueFieldTypeContext
...e/search/backend/elasticsearch/types/codec/impl/AbstractElasticsearchJavaTimeFieldCodec.java
Outdated
Show resolved
Hide resolved
...ate/search/backend/elasticsearch/types/codec/impl/AbstractElasticsearchVectorFieldCodec.java
Outdated
Show resolved
Hide resolved
...bernate/search/backend/elasticsearch/types/codec/impl/ElasticsearchBigDecimalFieldCodec.java
Outdated
Show resolved
Hide resolved
...h/backend/elasticsearch/types/dsl/impl/AbstractElasticsearchNumericFieldTypeOptionsStep.java
Outdated
Show resolved
Hide resolved
...ava/org/hibernate/search/engine/search/aggregation/dsl/impl/AvgAggregationFieldStepImpl.java
Outdated
Show resolved
Hide resolved
...nate/search/integrationtest/backend/elasticsearch/tmp/ElasticsearchMetricAggregationsIT.java
Outdated
Show resolved
Hide resolved
@marko-bekhta I just rebased the PR on top of the current main branch. Now I'm resuming to doing the changes... |
5a5619a
to
f3a45de
Compare
.../java/org/hibernate/search/engine/search/aggregation/spi/MetricDoubleAggregationBuilder.java
Outdated
Show resolved
Hide resolved
.../java/org/hibernate/search/engine/search/aggregation/spi/MetricDoubleAggregationBuilder.java
Outdated
Show resolved
Hide resolved
I just added two last commits to address the last @yrodiere's suggestions. Once we're fine with them, I'll reorganize the commits. |
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.
Thanks. Since you asked for my opinion, here's some -- I'll let @marko-bekhta take over though.
...ne/src/main/java/org/hibernate/search/engine/search/aggregation/spi/AggregationTypeKeys.java
Outdated
Show resolved
Hide resolved
...n/java/org/hibernate/search/engine/search/aggregation/spi/MetricFieldAggregationBuilder.java
Outdated
Show resolved
Hide resolved
...ne/src/main/java/org/hibernate/search/engine/search/aggregation/spi/AggregationTypeKeys.java
Outdated
Show resolved
Hide resolved
Thanks @yrodiere I applied all the great suggestions here. In my opinion returning a double would be better, but I have an idea... |
IMO we should just force users to pass a type. They ask for a date, we check if that's possible, and if so we return a date. They ask for an integer, same thing. They as for a double, ditto. |
IMO if you give the user the flexibility of requiring any type, it would be very complex (in term of API) and also error prone. I think that the solution of exposing a double for numeric avg and a field avg for all the types, it would safer and easier to use. |
I don't get this, they already have the flexibility to require any type: https://github.com/hibernate/hibernate-search/pull/4144/files#diff-6b1cb9769f69a0a38bbf7c3d35a53612d9d88e45f8180ba2cbe9eea36c1baea0R27-R41 And in fact there's already no default: if they get an Also, please note I'm not saying we should comply with every request. IMO there are only two types that make sense: the field type ( |
If I try to ask for a double a get this error in my test:
|
OK so I can revert the last commit? |
With
From what I've seen that commit is fine and the DSL changes at least should stay, but I might be mistaken. Can you point me to the exact failing test? |
Sure! Here is the commit I which I tried to ask for a double avg => 6abad63. Thanks |
28aebae
to
5bf82db
Compare
49cb72c
to
031f709
Compare
b83e97f
to
2373398
Compare
Hi @marko-bekhta, the commit HSEARCH-5133 Test all types with metric aggregations is in progress and I still need to address the other unresolved conversation. |
With this last push I think I have only one comment to address, the one about introducing |
With the last push I should have addressed all the comments. |
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.
Thanks Fabio!
I think we are getting close 🤞🏻😃. I've left some comments inline, but the main thing to solve is to address the ValueModel.RAW
case; right now, it can fail with an exception 🙈
.../search/integrationtest/backend/tck/testsupport/types/AnalyzedStringFieldTypeDescriptor.java
Outdated
Show resolved
Hide resolved
...e/search/integrationtest/backend/tck/testsupport/types/LocalDateTimeFieldTypeDescriptor.java
Outdated
Show resolved
Hide resolved
...te/search/integrationtest/backend/tck/testsupport/operations/MetricAggregationsTestCase.java
Outdated
Show resolved
Hide resolved
...te/search/integrationtest/backend/tck/testsupport/operations/MetricAggregationsTestCase.java
Show resolved
Hide resolved
...ate/search/backend/lucene/types/dsl/impl/AbstractLuceneNumericIndexFieldTypeOptionsStep.java
Outdated
Show resolved
Hide resolved
...earch/backend/lucene/types/aggregation/impl/AbstractLuceneMetricNumericFieldAggregation.java
Outdated
Show resolved
Hide resolved
...earch/backend/elasticsearch/search/aggregation/impl/ElasticsearchMetricFieldAggregation.java
Outdated
Show resolved
Hide resolved
9c15aa2
to
444f315
Compare
With last push... again just one comment left! |
Hi @marko-bekhta. Comment addressed (I hope :P) To fully support the RAW model type, I opened HSEARCH-5230 Support RAW model type with metric aggregations. |
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.
Thanks Fabio!
This looks nice 🎉 . Let's make sure we marked everything as incubating so that we will have some freedom to adjust if needed, and then we'll continue in the follow-up PRs as needed.
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
documentation/src/main/asciidoc/public/reference/_search-dsl-aggregation.adoc
Outdated
Show resolved
Hide resolved
...rc/main/java/org/hibernate/search/engine/search/aggregation/dsl/AvgAggregationFieldStep.java
Show resolved
Hide resolved
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
Co-authored-by: marko-bekhta <[email protected]>
81e751a
to
ce11484
Compare
I integrated the corrections for the doc and incubating rebasing the contribution on top of the current main branch. Thanks |
Quality Gate failedFailed conditions |
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.
Thanks @fax4ever ! 🎉
I'll merge this one and we can do the followups to address the RAW
ValueModel
and tests for other value models.
Thank you Marko and Yoann |
https://hibernate.atlassian.net/browse/HSEARCH-5133
1. we need to implement count, count distinct and avgdone!2. test filtering on nesteddone!3. test explicit ValueConvert.YES/NOdone!4. support and test aggregations for temporal typesdone!5. we need to implement the Lucene backenddone!6. write good tests covering all the fields typesdone from my side (check with the Hibernate team)7. write some docdone!