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

feat: Lateral table functions + some refactoring #3362

Merged
merged 23 commits into from
Dec 15, 2024
Merged

Conversation

scsmithr
Copy link
Member

@scsmithr scsmithr commented Dec 13, 2024

>> create temp table t (a int, b int);
┌─────────────────────┐
│ Query success       │
│ No columns returned │
└─────────────────────┘

>> insert into t values (3,6), (8,9);
┌───────────────┐
│ rows_inserted │
│ UInt64        │
├───────────────┤
│             2 │
└───────────────┘

>> select * from t, generate_series(a, b) order by 1,2,3;
┌───────┬───────┬─────────────────┐
│ a     │ b     │ generate_series │
│ Int32 │ Int32 │ Int64           │
├───────┼───────┼─────────────────┤
│     3 │     6 │               3 │
│     3 │     6 │               4 │
│     3 │     6 │               5 │
│     3 │     6 │               6 │
│     8 │     9 │               8 │
│     8 │     9 │               9 │
└───────┴───────┴─────────────────┘

@scsmithr scsmithr changed the title Sean/ref table func feat: Lateral table functions + some refactoring Dec 15, 2024
@scsmithr scsmithr marked this pull request as ready for review December 15, 2024 22:44
@scsmithr scsmithr merged commit 3653724 into main Dec 15, 2024
4 checks passed
@scsmithr scsmithr deleted the sean/ref-table-func branch December 15, 2024 22:44
Comment on lines +110 to +128
match state.function_state.poll_push(cx, inputs)? {
PollPush::Pending(_) => Ok(PollPush::Pending(orig)),
other => {
// Batch was pushed to the function state, compute additional
// outputs.
let additional_outputs = self
.projected_outputs
.iter()
.map(|expr| {
let arr = expr.eval(&batch)?;
Ok(arr.into_owned())
})
.collect::<Result<Vec<_>>>()?;

state.additional_outputs = additional_outputs;

Ok(other)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only allow two states out of the function.

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

Successfully merging this pull request may close these issues.

1 participant