-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[Transform] separate pivot and extract function interface #58744
[Transform] separate pivot and extract function interface #58744
Conversation
Pinging @elastic/ml-core (:ml/Transform) |
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 will have to read through it a second time.
The separation of "function" from "data" gives us flexibility. But, it seems we might be sacrificing polymorphism. I am unsure the best way to reconcile this right now as it is designed.
...plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java
Outdated
Show resolved
Hide resolved
...in/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/FunctionFactory.java
Outdated
Show resolved
Hide resolved
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 like the redesign it makes the code cleaner
...in/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/FunctionFactory.java
Outdated
Show resolved
Hide resolved
static Map<String, FieldCollector> createFieldCollectors(Map<String, SingleGroupSource> groups, String synchronizationField) { | ||
Map<String, FieldCollector> fieldCollectors = new HashMap<>(); | ||
|
||
for (Entry<String, SingleGroupSource> entry : groups.entrySet()) { |
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 don't know what we are gaining by not having SingleGroupSource
have a createFieldCollector
method. We would avoid this switch statement.
Are we just trying to keep from adding classes to core
?
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.
To me it seems unavoidable, config and implementation should be separate, like PivotConfig
and Pivot
. so far it was simple enough to put in into ...GroupSource
(which was totally ok). With the re-factoring it gets more complicated and there are already plans, that will add more code (maybe one day we end up with 1 class per GroupSource
).
Yes keeping code away from core
is a reason. If I would add it the implementation to ...GroupSource
, I would not only need to move the code there, but also the collector interface.
I think this change is similar to what is done in other places. The boiler-plate (switch) isn't great, but I do not see a need for something registry-style (like aggregations), at least at the moment.
33a9cc3
to
e36b418
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.
LGTM
👍 nice change
...e-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformProgressIT.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java
Outdated
Show resolved
Hide resolved
b4bb7cd
to
12601c2
Compare
separate pivot from the indexer and introduce an abstraction layer, pivot becomes a function. This opens
the possibility to add more functions to transform.
cleaned up version of #55287 after removing experimental code
piggy backed fixes:
Review hints
Function
interfaceFunction.ChangeCollector
, all pivot related parts are now inCompositeBucketsChangeCollector
ToDo's
Must
Found problems not introduced by this PR