Improve GafferPop NamedOperations handling #3127
Labels
enhancement
Improvement to existing functionality/feature
tech-debt
Relates to Technical Debt
tinkerpop
Specific to/touches the tinkerpop module
Milestone
Description
Currently to run a Named Operation with GafferPop requires the return type of the Named Operation to be known before the Operation is called. This is needed because if the operation returns an
Iterable
there's an assumption this contains elements which should be converted to TinkerPop elements (using a Generator). This is done using a second operation in the OperationChain. This conversion step is not required or performed if the operation does not return anIterable
.To discover the return type for the Named Operation, all Named Operations are fetched, the requested Operation located, and its return type extracted. Fetching all these details is not efficient.
Additionally, relying on the return type being
Iterable
does not confirm that theIterable
contains Elements at all. This could result in errors. The parametrised type contained inside theIterable
is not available as part of the Named Operation, though it could probably be added.Additional context
Approaches to fixing this could include:
Iterable
then run the Generator manually over all items. This removes any need to look up Named Operation details, but loses 'laziness' from theIterable
.Iterable
wrapping the return result and converting each Element with the TinkerPop generator as and when it is accessed - avoiding loss of 'laziness'.If
predicate) run the generator as part of the OperationChain itself.PR comment with some contextual info.
The text was updated successfully, but these errors were encountered: