Details
-
Improvement
-
Status: Closed
-
Critical
-
Resolution: Won't Do
-
3.6.2
-
None
-
None
Description
Related issue (fixed): https://issues.apache.org/jira/browse/TINKERPOP-2924
Working on optimization strategies sometimes require replacing steps with extended version of those steps. At this moment not all steps can be extended due to being `final` (like `ProjectStep`, `PropertyKeyStep`, `PropertyValueStep`, `RangeLocalStep`, `SumLocalStep`, and many more). Thus, it requires creating a similar step and duplicate some logic there instead of simply extending a specific step.
For those steps which are non-final there are sometimes private fields without any getter methods (for example `private CallbackRegistry<Event> callbackRegistry` in `DropStep` is `private`. Thus, the caller needs to use Reflaction API to retrieve it's value).
In JanusGraph we replace some steps with the extended version of those steps.
For example, we completely overwrite `flatMap` step of `PropertiesStep` which is an anti-pattern, but in the case when it's hard to extend specific logic parts such anti-pattern might be a a good solution I guess.
I think it would make sense to let Graph developers to extend any step and has access to it's fields / utility methods.
In such case we could do similar with `ProjectStep` and make it query data in parallel (see issue: https://github.com/JanusGraph/janusgraph/issues/3559 ).
I'm also good not doing it in case anyone can suggest other patterns to follow for those optimizations instead of overwriting logic.