Skip to content

refactor: Refactor spark make_interval signature away from user defined - #19027

Merged
Jefffrey merged 4 commits into
apache:mainfrom
kumarUjjawal:refactor/make_interval
Dec 4, 2025
Merged

Jefffrey merged 4 commits into
apache:mainfrom
kumarUjjawal:refactor/make_interval

Conversation

@kumarUjjawal

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

As per the goal stated that we should avoid using the user_defined in useful places

What changes are included in this PR?

Refactored the spark/mark_interval

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added the spark Changes to datafusion-spark crate label Dec 1, 2025

@Jefffrey Jefffrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up, have some suggestions around organization of the code

let mut variants = Vec::with_capacity(8);
variants.push(TypeSignature::Nullary);

for len in 1..=7 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think I would prefer inlining the signature instead of generating it via this for loop logic; for example:

Signature::one_of(
    vec![
        TypeSignature::Nullary,
        // year
        TypeSignature::Coercible(vec![float64.clone()]),
        // year, month
        TypeSignature::Coercible(vec![float64.clone(), float64.clone()]),
        // etc.
    ],
    Volatility::Immutable,
)

kumarUjjawal and others added 2 commits December 2, 2025 10:25
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
@kumarUjjawal
kumarUjjawal requested a review from Jefffrey December 2, 2025 09:33
@Jefffrey

Jefffrey commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Could we have the comments as suggested in my previous review comment, to indicate the args of year, month, etc.?

@kumarUjjawal

Copy link
Copy Markdown
Contributor Author

Sure, i thought you only put the comments to explain it to me. I will make the changes.

@kumarUjjawal

Copy link
Copy Markdown
Contributor Author

Added the comments as suggested.

@Jefffrey
Jefffrey added this pull request to the merge queue Dec 4, 2025
Merged via the queue into apache:main with commit 6751f44 Dec 4, 2025
27 checks passed
@Jefffrey

Jefffrey commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Thanks @kumarUjjawal & @martin-g

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

Labels

spark Changes to datafusion-spark crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants