Gaffer
Gaffer copied to clipboard
ApplyViewToElementsFunction does not apply Schema validation
Describe the bug ApplyViewToElementsFunction will apply the View of an operation to the results from multiple subgraphs. This is meant to ensure that the results are correctly aggregated and validated after a query to a FederatedStore.
However, despite the View validation being applied, the Schema validation is not applied. This could be intended, but I suspect it is not, as the intention of this merge function is to ensure all aggregation and validation happens as if the results came from one graph. If this is indeed unintended, I would suggest the merge function should be renamed to something like ValidateAndAggregateElements.
Additional context The reason this happens is that the results are currently merged inside a MapStore and the MapStore does not currently support schema validation: https://github.com/gchq/Gaffer/issues/2613.
Some potential fixes are:
- Add MapStore validation as suggested in https://github.com/gchq/Gaffer/issues/2613.
- Change the ApplyViewToElementsFunction to create an ephemeral AccumuloStore rather than MapStore
Test to pass here.
https://github.com/gchq/Gaffer/tree/gh-3059-federated-store-applyviewtoelements-schema-validation
Having the this tap into an existing instance of AccumuloStore for the temporary map is the way forward. but this won't work with a GAAS situation with a FederatedStore which only has ProxiesStore pointed at a remote Gaffer graph.
Technically the Function is called "ApplyView" to elements. which is does do. But I think it should be better and apply the Schema Validation.
It seems the the Schema can be searched for any Group's Validation function and these can be used in a View post aggregate filter. The View is made if it doesn't exist or it merges if it does.
PostAggregate because this happens after the GroupBy aggregation.
Work contributing to this exists in the branch gh-3059-federated-store-applyviewtoelements-schema-validation. This should be the starting point if work resumes on this PR.