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

Feature proposal: Join operator on associative arrays #5477

Open
dquintanatorres opened this issue Nov 6, 2024 · 1 comment
Open

Feature proposal: Join operator on associative arrays #5477

dquintanatorres opened this issue Nov 6, 2024 · 1 comment

Comments

@dquintanatorres
Copy link

New feature

Hello! Recently, I encountered a need to join two associative arrays within a workflow. While I have been proposed a workaround to manage this, I believe an operator for directly joining associative arrays would be highly convenient. Ideally, this operator would allow specifying a shared key or key pair, similar to SQL-style joins. Extending this to support various join types (inner, outer, left, right, etc.) and scenarios would be extremely valuable.

Usage scenario

Here’s an example use case:

workflow {    

    ch1 = Channel.of( [id: "a", foo: 1], [id: "b", foo: 2] )
    ch2 = Channel.of( [id: "b", bar: 4], [id: "a", bar: 3] )

    ch1
        .join(ch2, by: id, type: 'inner')
        .view()

}

// Output:

// [id: "a", foo: 1, bar: 3]
// [id: "b", foo: 2, bar: 4] 

@dquintanatorres dquintanatorres changed the title Feature proposal: Join operator on associative arrays by key Feature proposal: Join operator on associative arrays Nov 6, 2024
@bentsherman
Copy link
Member

A better join operator is in the works. Not sure when it will be introduced, but I intend to make it do a proper SQL join and work with any data type rather than just lists.

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

No branches or pull requests

2 participants