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

Query not returning expected result #43

Open
TcM1911 opened this issue Jan 2, 2022 · 2 comments
Open

Query not returning expected result #43

TcM1911 opened this issue Jan 2, 2022 · 2 comments

Comments

@TcM1911
Copy link

TcM1911 commented Jan 2, 2022

I have a graph where 4 nodes (T1 through T4) are connected like this:

[T1] <-(E2)- [T2] <-(E3)- [T3] -(E4)-> [T4]

The goal of my query is:

Given a T1, find the T4 items.

The kind for T1, T2 and T3 are known but the type for T4 is not. For some reason the follwing query does not work (traversing from the left to right: T1 to T2 to T3 to T4).

get T1 where key = "%s"
    traverse in:E2:out:T2
        traverse in:E3:out:T3
            traverse out:E4:in:
            end
        end
    end

Traversing the nodes and edges in reverse works fine (Right to left).

get T4 where key = "%s"
    traverse in:E4:out:T3
        traverse out:E3:in:T2
            traverse out:E2:in:
            end
        end
    end
show 4:n:key

If I instead start on a node for T2, traverse to T1 and check the contstraint, followed by traversing T2 to T3 to T4 works fine.

get T2
    traverse out:E2:in:T1 where key = "%s"
    end 
    traverse in:E3:out:T3
        traverse out:E4:in:
        end
    end

Alternative, if a use full wildcards for the second and the third traversal, T4 is returned (plus some extra data...)

get T1 where key = "%s"
    traverse in:E2:out:T2
        traverse :::
            traverse :::
            end
        end
    end
show 4:n:key

I can't see why the first query doesn't work. Given that traversing in the reverse works, suggests that the graph is correct. Any idea what the issue is?

@krotik
Copy link
Owner

krotik commented Jan 3, 2022

Hey there,

I am not able to reproduce the issue. I've added a test which attempts to test this scenario (see eql/regression_test.go for "Issue 43").

The result of the query is:

Labels: T1 Key, T1 Name, T2 Key, T2 Name, T3 Key, T3 Name, Key, Kind, Name
Format: auto, auto, auto, auto, auto, auto, auto, auto, auto
Data: 1:n:key, 1:n:name, 2:n:key, 2:n:name, 3:n:key, 3:n:name, 4:n:key, 4:n:kind, 4:n:name
t1, T1 node, t2, T2 node, t3, T3 node, t4, T4, T4 node

I would expect this result. Could you have a look if I made a mistake or if the failing scenario needs some further conditions to show the unexpected result?

@TcM1911
Copy link
Author

TcM1911 commented Jan 4, 2022

Thanks @krotik. The test looks right. I'll see if I can write some code that I can share that replicates the code I have and reproduces the same issue. It may take a few days until I can get to it though.

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

No branches or pull requests

2 participants