fix: eager source row fetching logic (#2071) #52
Merged
+172
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an old bug which could only surface with the more recent addition of custom Cypher queries.
The template tries to pre-fetch source data.
It does it for text sources, since they do not support SQL pushdown, so their data is required for post-processing anyway.
Before this commit, the template also pre-fetched data when none of the source's targets defined source transformations.
This is overly restrictive and actually wrong.
Custom query targets cannot define source transformations.
If they share a source with a node/rel targets that define custom source transformations, then the template would crash with a NPE.
This is now fixed. Source data is pre-fetched as long as there is at least one of its target that does not define any transformation.
The commit also adds another small optimization: if the source does not match any active targets, the source processing is skipped completely. Before that, the data could be pre-fetched, incurring unnecessary data movement.