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

Support 1 or 3 arg in generate_series() UDTF #13856

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

UBarney
Copy link

@UBarney UBarney commented Dec 20, 2024

Which issue does this PR close?

Closes #13615.

Rationale for this change

What changes are included in this PR?

  • Added some args validation to GenerateSeriesTable
  • Added step field to GenerateSeriesState, and added support for generating series with custom step

Are these changes tested?

sqllogictests for generate_series() UDTF

Are there any user-facing changes?

No

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Dec 20, 2024
@UBarney UBarney force-pushed the gen_series_1_and_3_args branch 2 times, most recently from 935610b to 93520be Compare December 20, 2024 09:56
@UBarney UBarney force-pushed the gen_series_1_and_3_args branch from 93520be to 5803583 Compare December 20, 2024 11:38
Copy link
Contributor

@goldmedal goldmedal left a comment

Choose a reason for hiding this comment

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

Thanks @UBarney. Overall looks good to me but some minor comments.
cc @2010YOUY01

Comment on lines +33 to +38
#[derive(Debug, Clone)]
enum GenSeriesArgs {
ContainsNull,
AllNotNullArgs { start: i64, end: i64, step: i64 },
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to add some doc for the enum and its variants.

ContainsNull,
AllNotNullArgs { start: i64, end: i64, step: i64 },
}

/// Table that generates a series of integers from `start`(inclusive) to `end`(inclusive)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the comment should be updated for step.

start: Option<i64>,
// None if input is Null
end: Option<i64>,
args: GenSeriesArgs,
}

/// Table state that generates a series of integers from `start`(inclusive) to `end`(inclusive)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. It should be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support 1 or 3 arg in generate_series() UDTF
2 participants