Skip to content

Add NUMBER support#610

Open
lpoulain wants to merge 1 commit into
trinodb:masterfrom
lpoulain:ENG-9425-add-NUMBER-support-to-python-client
Open

Add NUMBER support#610
lpoulain wants to merge 1 commit into
trinodb:masterfrom
lpoulain:ENG-9425-add-NUMBER-support-to-python-client

Conversation

@lpoulain

Copy link
Copy Markdown
Member

Add NUMBER support

Description

Support Trino NUMBER type by performing the following:

  • Passes the NUMBER to the Trino Client Capabilities header so that such type is not returned as a varchar
  • Maps this type to a Decimal

Non-technical explanation

Support Trino NUMBER type

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(X) Release notes are required, with the following suggested text:

Support Trino NUMBER type

* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot Bot added the cla-signed label Jun 24, 2026
@lpoulain lpoulain requested review from hashhar and wendigo June 24, 2026 13:37
@wendigo wendigo requested a review from azawlocki-sbdt June 24, 2026 13:48
@lpoulain lpoulain force-pushed the ENG-9425-add-NUMBER-support-to-python-client branch from f91595b to a875704 Compare June 24, 2026 14:16

@azawlocki-sbdt azawlocki-sbdt 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.

I'd add some more tests for numeric literals, otherwise LGTM

Comment thread tests/unit/test_mapper.py
Comment on lines +41 to +45
def test_number_column_maps_value_to_decimal(self):
mapper = RowMapperFactory()._create_value_mapper(_column("number"))
result = mapper.map("10.3")
assert isinstance(result, Decimal)
assert result == Decimal("10.3")

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.

Please add test cases for exponential notation (positive and negative exponents) and negative literals.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've added some extra tests, including the NUMBER corner cases.

@lpoulain lpoulain force-pushed the ENG-9425-add-NUMBER-support-to-python-client branch from a875704 to e4db914 Compare June 26, 2026 15:12
@wendigo

wendigo commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

cc @findepi

@lpoulain lpoulain requested a review from azawlocki-sbdt June 26, 2026 15:32
Comment thread tests/unit/test_mapper.py Outdated

def test_number_column_maps_infinity(self):
mapper = RowMapperFactory()._create_value_mapper(_column("number"))
assert mapper.map("Infinity") == Decimal("Infinity")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. Fixed.

@findepi findepi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add test with +Infinity

Add NUMBER support
@lpoulain lpoulain force-pushed the ENG-9425-add-NUMBER-support-to-python-client branch from e4db914 to 4131c8a Compare June 26, 2026 15:53
@lpoulain lpoulain requested a review from findepi June 26, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants