-
Notifications
You must be signed in to change notification settings - Fork 244
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-4577 @ProjectionConstructor: aggregating multi-valued field/object projections in Set, SortedSet, etc. instead of List #4344
HSEARCH-4577 @ProjectionConstructor: aggregating multi-valued field/object projections in Set, SortedSet, etc. instead of List #4344
Conversation
18591e8
to
8619389
Compare
ee42a82
to
6b53306
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.
Just noticed this was still pending -- did you encounter any problem? Did I forget a review? :x
...elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/logging/impl/Log.java
Outdated
Show resolved
Hide resolved
Problems ? no no problems, only opportunities 😄.
mm ok 😃 I can rename it 👍🏻 (it was good I left the PR hanging here 😄) So if we go with |
I guess that's what makes most sense, yes. BTW I wonder if we could just use |
ok 😃, yeah that's what I thought too ... that we are not collecting in that particular place ...
hah I was just looking at the collector interface 😄, but yeah I agree that it's for the other PR. But if we want to explore that option, should I mark |
6b53306
to
2a56f99
Compare
That's probably a good idea regardless of our plans, yes. |
5793d12
to
6c94d65
Compare
6c94d65
to
32db920
Compare
32db920
to
ef4706e
Compare
|
@SuppressWarnings("unchecked") | ||
@Override | ||
public V[] doFinish(List<V> accumulated) { | ||
V[] array = (V[]) Array.newInstance( elementType, accumulated.size() ); |
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.
Soooo following the discussion at https://hibernate.zulipchat.com/#narrow/channel/132094-hibernate-orm-dev/topic/StandardStack.20and.20reflection
I guess this won't fly well with Quarkus too 😖 😃....
I can change this to use IntFunction<T[]>
and simply use accumulated.toList( ... )
but then..... it won't work fine here:
Lines 417 to 419 in 12cd6cb
else if ( containerType.isArray() ) { | |
reference = ProjectionCollector.array( containerElementType ); | |
} |
so we could do something like for sorted sets and throw an exception. Or give two ways to create array collector with class and with function. Use class in the ProjectionBindingContextImpl
and it'll fail for users so they'd need to register their arrays themselves .... @yrodiere WDYT ? 🙈
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 think it's fine-ish, as this only happens when a user explicitly requests an array, so it's reasonable to expect them to register that array type for reflection.
For ProjectionBindingContextImpl
, I suppose we can add something to Quarkus that would detect projection constructors and register for reflection any array type used in their parameters. But only if we consider this important enough -- I personally don't. I wouldn't even have provided the feature TBH, because using arrays in domain models is a big no-no in my books. But now that it's there, I guess we might as well keep it.
https://hibernate.atlassian.net/browse/HSEARCH-4577
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.