Skip to content

feat: add is_nullable scalar UDF#21387

Open
adriangb wants to merge 2 commits intoapache:mainfrom
pydantic:is-nullable-udf
Open

feat: add is_nullable scalar UDF#21387
adriangb wants to merge 2 commits intoapache:mainfrom
pydantic:is-nullable-udf

Conversation

@adriangb
Copy link
Copy Markdown
Contributor

@adriangb adriangb commented Apr 5, 2026

Summary

  • Adds is_nullable(expression) scalar UDF that returns the schema-level nullability of the input expression as a boolean
  • Completes the Arrow field introspection set alongside arrow_typeof and arrow_metadata
  • Returns true for nullable columns/expressions, false for non-nullable ones (NOT NULL columns, concrete literals)

Test plan

  • Added sqllogictest (is_nullable.slt) covering:
    • Literal expressions (non-nullable: is_nullable(1) → false)
    • NULL literal (nullable: is_nullable(NULL) → true)
    • Nullable columns (id, name from table_with_metadata)
    • Non-nullable columns (ts, nonnull_name from table_with_metadata)
    • Expression nullability propagation (id + 1 inherits nullable)
  • cargo fmt --all passes
  • cargo clippy passes
  • Regenerated scalar_functions.md docs

🤖 Generated with Claude Code

@github-actions github-actions bot added documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Apr 5, 2026
adriangb and others added 2 commits April 5, 2026 13:54
…ection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adriangb adriangb marked this pull request as draft April 5, 2026 22:05
@adriangb adriangb marked this pull request as ready for review April 7, 2026 12:42
@adriangb
Copy link
Copy Markdown
Contributor Author

adriangb commented Apr 7, 2026

@martin-g another one around introspection. Up to you but one option would be to close this PR and say "use arrow_field(...)['nullable']

@martin-g
Copy link
Copy Markdown
Member

martin-g commented Apr 7, 2026

"use arrow_field(...)['nullable']"

I like it!

@adriangb
Copy link
Copy Markdown
Contributor Author

adriangb commented Apr 7, 2026

Okay lets focus on #21389 for now then

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

Labels

documentation Improvements or additions to documentation functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants