2

I have a dataframe below:

employee_id|employee_name|manager_employee_id|
----------------------------------------------
    1           eric (ceo)      1
    2           edward          1
    3           john            1
    4           james           2
    5           ella            4

I would like to use spark (scala) graphframe logic to achieve the following:

employee_id|employee_name|manager_employee_id|level|hierarchy
-------------------------------------------------------------
    1           eric            1                0    /1
    2           edward          1                1    /1/2
    3           john            1                1    /1/3
    4           james           2                2    /1/2/4
    5           ella            3                3    /1/2/4/5

Any help would be much appreciated

1 Answer 1

0

I think the answer you are looking for is more or less related to this.

The only modification required at your end will be aggregating the messages to get the complete hierarchy . For that part you can refer to this.

A combination of above two will get you the desired results.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.