Skip to content

Matching GETPART() behavior between dialects - #547

Merged
john-sanchez31 merged 10 commits into
mainfrom
John/fix_getpart
Aug 20, 2026
Merged

Matching GETPART() behavior between dialects #547
john-sanchez31 merged 10 commits into
mainfrom
John/fix_getpart

Conversation

@john-sanchez31

@john-sanchez31 john-sanchez31 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Linked ticket

Closes #403

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Docs / config

What changed and why?

  • Fixes the difference between dialects for GETPART(). Makes index out of range and when the delimiter is at the beginning/end of the string GETPART(".string.", ".", idx) return empty string '' instead of NULL. This matches the Snowflake function SPLIT_PART on which GET_PART is based.
  • No more harmonization for '' and None
  • Since Oracle treats the empty string as NULL, override some test to match this behavior is required (get_part_test, replace, strip, step_slicing, padding_functions, get_part_test and get_part_multiple)

How I tested this?

  • Through the current tests for this specific functionality for all dialects.

Notes for reviewers

@john-sanchez31 john-sanchez31 linked an issue Aug 5, 2026 that may be closed by this pull request
@john-sanchez31 john-sanchez31 added bug Something isn't working effort - low quick & simple issue testing Alters the testing/CI process for PyDough labels Aug 5, 2026
@john-sanchez31 john-sanchez31 changed the title Matching GET_PART() behavior through dialects Matching GET_PART() behavior between dialects Aug 5, 2026
Comment thread tests/testing_utilities.py

# float vs None. Convert to nullable floats
if any(isinstance(elem, (float, NoneType)) for elem in column_a) and any(
if all(isinstance(elem, (float, NoneType)) for elem in column_a) and all(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Prevents a column with None type and for example string entering the if.

@john-sanchez31 john-sanchez31 changed the title Matching GET_PART() behavior between dialects Matching GETPART() behavior between dialects Aug 6, 2026

@hadia206 hadia206 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.

Looks good to me. I have a couple of questions regarding Oracle tests.

Comment thread tests/testing_utilities.py
SECOND_ARGUMENT AS delim,
THIRD_ARGUMENT AS idx
THIRD_ARGUMENT AS idx,
0 AS is_last

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.

Add comment clarifying what's the purpose of this.

Comment on lines +491 to +494
if custom_functions_test_data.test_name == "get_part_test":
# In Oracle None and empty string are treated the same, so we need to
# modify the reference solution data to match this behavior.
return PyDoughPandasTest(

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.

Isn't get_part_test already updated above in the same file. Why change here again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this test is from custom_functions not defog so I deleted the first one good catch!

@knassre-bodo knassre-bodo 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.

Make sure to document the new behavior in functions.md, otherwise LGTM :)

@john-sanchez31
john-sanchez31 merged commit 0187a4b into main Aug 20, 2026
63 of 69 checks passed
@john-sanchez31
john-sanchez31 deleted the John/fix_getpart branch August 20, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort - low quick & simple issue testing Alters the testing/CI process for PyDough

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix GETPART function implementation in base transform binding

3 participants