Skip to content

feat(spark): Implement Spark string function luhn_check #16848

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

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

Conversation

Standing-Man
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

WIP: adding the suggestion.

What changes are included in this PR?

Implement Spark luhn_check function

Are these changes tested?

Yes

Are there any user-facing changes?

Yes

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Jul 22, 2025
@Standing-Man Standing-Man changed the title feat(spark): Implement Spark luhn_check function feat(spark): Implement Spark string function luhn_check Jul 22, 2025
Comment on lines +117 to +126
query error
select luhn_check(6011111111111117::BIGINT)


query error
select luhn_check(6011111111111118::BIGINT)


query error
select luhn_check(123.456::decimal(6,3))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @comphead, For inputs like fractional, exponential, or negative numbers, the current implementation just reports that luhn_check doesn't support them. I'm not sure if that's the right approach.

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

Successfully merging this pull request may close these issues.

[datafusion-spark] Implement Spark string function luhn_check
1 participant