Skip to content

Fail correctly when Python UDF decimal result overflows#28925

Merged
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/test-python-udf-with-non-finite-decimal-result-f657ef
Mar 30, 2026
Merged

Fail correctly when Python UDF decimal result overflows#28925
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/test-python-udf-with-non-finite-decimal-result-f657ef

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Mar 30, 2026

Python function runtime expect that decimal.Decimal is used when function result is mapped to SQL DECIMAL value. Python's Decimal supports non-finite values: NaN, -Infinity and +Infinity and values outside of SQL DECIMAL range.

Add tests that TrinoException is correctly thrown when an non-mappable value is returned. For overflow this was not the case.

@findepi findepi requested review from electrum and wendigo March 30, 2026 14:03
@findepi findepi added the no-release-notes This pull request does not require release notes entry label Mar 30, 2026
@cla-bot cla-bot bot added the cla-signed label Mar 30, 2026
Python function runtime expect that `decimal.Decimal` is used when
function result is mapped to SQL DECIMAL value. Python's `Decimal`
supports non-finite values: NaN, -Infinity and +Infinity and values
outside of SQL DECIMAL range.

Add tests that TrinoException is correctly thrown when an non-mappable
value is returned. For overflow this was not the case.
@findepi findepi force-pushed the findepi/test-python-udf-with-non-finite-decimal-result-f657ef branch from a6558ab to cc61323 Compare March 30, 2026 14:20
@findepi findepi merged commit f41eca1 into trinodb:master Mar 30, 2026
18 checks passed
@findepi findepi deleted the findepi/test-python-udf-with-non-finite-decimal-result-f657ef branch March 30, 2026 15:30
@github-actions github-actions bot added this to the 481 milestone Mar 30, 2026
@ebyhr ebyhr mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed no-release-notes This pull request does not require release notes entry

Development

Successfully merging this pull request may close these issues.

3 participants