Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Elements/Edges/Entities definitions only applied when there is an explicit edge/element definition #2293

Closed
j8934893 opened this issue Jul 8, 2020 · 2 comments · Fixed by #2343
Labels
bug Confirmed or suspected bug
Milestone

Comments

@j8934893
Copy link

j8934893 commented Jul 8, 2020

Combinations of globalEdges/globalEntities/globalElements and properties/groupBy/predicates do not work as intended when no explicit element definition is included.

For example:

{
    "class": "uk.gov.gchq.gaffer.operation.impl.get.GetElements",
    "options": {
        "gaffer.federatedstore.operation.graphIds": "Combined_Graph"
    },
    "view": {
        "globalEdges": [
            {
                "groupBy": []
            }
        ]
    },
    "input": [...]
}

Returns all edges and entities without aggregation (adding allEdges/allEntities params makes no difference).

However, inheritance from global definitions does appear to work. If an explicit edge or entity is defined in the view then it will inherit from the global.

For example:

{
    "class": "uk.gov.gchq.gaffer.operation.impl.get.GetElements",
    "options": {
        "gaffer.federatedstore.operation.graphIds": "Combined_Graph"
    },
    "view": {
        "edges": {
            "<example_edge>": {
                "properties": [
                    "count"
                ]
            }
        },
        "globalEdges": [
            {
                "groupBy": []
            }
        ]
    },
    "input": [...]
}

Returns <example_edge> edges with only the "count" property (as expected from the explicit edge definition) but those edges are aggregated in line with the globalEdge groubBy.

Tested on a Federated Graph setup.

Could be linked to #2290

@d47853
Copy link
Member

d47853 commented Jul 15, 2020

Thanks for reporting this. I just tested this against the Accumulo Store and it seems global elements were working as expected when no element definitions were supplied. Therefore is caused by the same underlying flaw as the all_edges issue. I will move this to Gaffer as that seems to be where the bug resides

@d47853 d47853 transferred this issue from gchq/gaffer-tools Jul 15, 2020
@d47853 d47853 added bug Confirmed or suspected bug p:high labels Jul 15, 2020
@d47853 d47853 added this to the v1.13.0 milestone Jul 15, 2020
@d47853 d47853 closed this as completed Aug 7, 2020
@d47853 d47853 reopened this Aug 7, 2020
@d47853 d47853 modified the milestones: v1.13.0, v1.14.0 Sep 4, 2020
@sw96411
Copy link
Contributor

sw96411 commented Nov 13, 2020

I've been having a look at this and wanted to leave some interim notes here:

I think the cause here - certainly when run via FederatedStore, is that expandGlobalDefinitions in View gets run (at least) twice, both times from _execute in Graph. The first time is for the federated store, second and subsequent times for substores. Running this on the federated store should be a noop, but it isn't because expandGlobalDefinitions explicitly sets global[Edges|Elements|Entities] to null.

This means that by the time the operation is delegated down to a substore, the global* element of the view has been removed. It's NOT been translated into individual elements of the view like you might expect, because the very first time it was run was on a store with no schema (the federated store) so expanding the global was a noop, except for the fact globalElements was then set to null as above.

Ugly workaround is to only set global[Elements|Edges|Entities] to null if the schema is non-empty, but I want to think about a better way of resolving this issue.

ETA - there may also be a seperate issue with ensuring any pre and post aggregagation filters in the global* are copied into the relevant edges and entities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed or suspected bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants