Skip to content

Conversation

@batmnnn
Copy link
Contributor

@batmnnn batmnnn commented Dec 19, 2025

Fixes apache/datafusion #19162

The SparkAbs UDF was using the default is_nullable=true for all outputs, even when inputs were non-nullable. This commit implements return_field_from_args to properly propagate nullability from input arguments.

Changes:

  • Add return_field_from_args implementation to SparkAbs
  • Output nullability now matches input nullability
  • Handle edge case where scalar argument is explicitly null
  • Add tests for nullability behavior

Which issue does this PR close?

Closes #19162

Rationale for this change

SparkAbs was always returning nullable=true even for non-nullable inputs.

What changes are included in this PR?

Implement return_field_from_args to propagate nullability from input arguments.

Are these changes tested?

Yes, added 2 tests for nullability behavior.

Are there any user-facing changes?

No.

Fixes apache#19162

The SparkAbs UDF was using the default is_nullable=true for all outputs,
even when inputs were non-nullable. This commit implements
return_field_from_args to properly propagate nullability from input
arguments.

Changes:
- Add return_field_from_args implementation to SparkAbs
- Output nullability now matches input nullability
- Handle edge case where scalar argument is explicitly null
- Add tests for nullability behavior
@github-actions github-actions bot added the spark label Dec 19, 2025
@batmnnn
Copy link
Contributor Author

batmnnn commented Dec 19, 2025

@martin-g @rluvaton can you please review this

Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
@batmnnn
Copy link
Contributor Author

batmnnn commented Dec 19, 2025

thanks @martin-g

@Jefffrey Jefffrey added this pull request to the merge queue Dec 25, 2025
Merged via the queue into apache:main with commit e586ff5 Dec 25, 2025
27 checks passed
@Jefffrey
Copy link
Contributor

Thanks @batmnnn & @martin-g

@batmnnn
Copy link
Contributor Author

batmnnn commented Dec 25, 2025

thanks for guidance and help @Jefffrey & @martin-g

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spark abs need to have custom nullability

3 participants