Gaffer icon indicating copy to clipboard operation
Gaffer copied to clipboard

ApplyViewToElementsFunction does not apply Schema validation

Open t92549 opened this issue 2 years ago • 5 comments

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

t92549 avatar Nov 02 '23 16:11 t92549

Test to pass here.

https://github.com/gchq/Gaffer/tree/gh-3059-federated-store-applyviewtoelements-schema-validation

GCHQDev404 avatar Nov 02 '23 16:11 GCHQDev404

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.

GCHQDev404 avatar Nov 02 '23 16:11 GCHQDev404

Technically the Function is called "ApplyView" to elements. which is does do. But I think it should be better and apply the Schema Validation.

GCHQDev404 avatar Nov 02 '23 16:11 GCHQDev404

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.

GCHQDev404 avatar Nov 03 '23 16:11 GCHQDev404

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.

GCHQDeveloper314 avatar Jun 07 '24 16:06 GCHQDeveloper314