Skip to content

Add ParseInt udf#190

Merged
haileyok merged 11 commits intoroostorg:mainfrom
bealsbe:udf/parseint
Apr 1, 2026
Merged

Add ParseInt udf#190
haileyok merged 11 commits intoroostorg:mainfrom
bealsbe:udf/parseint

Conversation

@bealsbe
Copy link
Copy Markdown
Contributor

@bealsbe bealsbe commented Mar 24, 2026

Description

The goal of this PR is to add a new ParseInt UDF to the sml rules language. The UDF converts a numeric string to an integer.

Example sml:

  Result: int = ParseInt(s="42")                                                                                                                                                                                   
  # 42                                                                                                                                                                                                             
                                                                                                                                                                                                                   
  Result: int = ParseInt(s="-7")
  # -7                                                                                                                                                                                                             
                  
  Result: int = ParseInt(s="ABC")
  # None     
  

note: I wasn't too sure on what category to put this udf into. I am open to feedback to change the name.

Checklist

  • Tests pass locally
  • uv run ruff check . passes (no unused imports or other lint errors)
  • uv tool run fawltydeps --check-unused --pyenv .venv passes (no unused dependencies)

@bealsbe bealsbe requested review from a team, EXBreder, ayubun, haileyok and vinaysrao1 as code owners March 24, 2026 00:21
Copy link
Copy Markdown
Collaborator

@haileyok haileyok left a comment

Choose a reason for hiding this comment

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

lgtm, and i like the CAST name personally since STRING feels a bit weird for this sort of thing imo

Copy link
Copy Markdown
Collaborator

@haileyok haileyok left a comment

Choose a reason for hiding this comment

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

oh i think it needs to get registered here? https://github.com/roostorg/osprey/blob/main/osprey_worker/src/osprey/worker/_stdlibplugin/udf_register.py#L68 (just req'ing changes so someone else doesnt merge on accident but otherwise looks good)

@bealsbe
Copy link
Copy Markdown
Contributor Author

bealsbe commented Apr 1, 2026

oh i think it needs to get registered here? https://github.com/roostorg/osprey/blob/main/osprey_worker/src/osprey/worker/_stdlibplugin/udf_register.py#L68 (just req'ing changes so someone else doesnt merge on accident but otherwise looks good)

Good catch! I updated the PR to add the missing piece.

Copy link
Copy Markdown
Collaborator

@haileyok haileyok left a comment

Choose a reason for hiding this comment

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

thanks!!

@haileyok haileyok merged commit e56b202 into roostorg:main Apr 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants