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

Make key_indices optional to distinguish from an empty group by and no group by. #552

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

jacksonrnewhouse
Copy link
Contributor

This makes key_indices in ArroyoSchema an Option<Vec>, as when a query groups by only a time window we need to shuffle all data together. This approach won out over trying to mutate the SQL graph to insert a dummy key.

@@ -171,8 +171,10 @@ impl ArrowOperator for KafkaSinkFunc {
async fn process_batch(&mut self, batch: RecordBatch, ctx: &mut ArrowContext) {
let values = self.serializer.serialize(&batch);

if !ctx.in_schemas[0].key_indices.is_empty() {
let k = batch.project(&ctx.in_schemas[0].key_indices).unwrap();
if ctx.in_schemas[0].key_indices.is_some() {
Copy link
Member

Choose a reason for hiding this comment

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

Could this be an if let instead of if/unwrap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

qs: usize,
) -> impl Iterator<Item = (usize, RecordBatch)> + 'a {
let mut buf = vec![0; record.num_rows()];

if !keys.is_empty() {
let keys: Vec<_> = keys.iter().map(|i| record.column(*i).clone()).collect();
if keys.is_some() {
Copy link
Member

Choose a reason for hiding this comment

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

could this be an if-let?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@jacksonrnewhouse jacksonrnewhouse merged commit e0e0851 into dev Mar 4, 2024
6 checks passed
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.

2 participants