Skip to content

fix: Widen Athena integer type mapping for unsigned ints - #6739

Draft
nikolauspschuetz wants to merge 1 commit into
feast-dev:masterfrom
nikolauspschuetz:fix/athena-uint-widening
Draft

fix: Widen Athena integer type mapping for unsigned ints#6739
nikolauspschuetz wants to merge 1 commit into
feast-dev:masterfrom
nikolauspschuetz:fix/athena-uint-widening

Conversation

@nikolauspschuetz

Copy link
Copy Markdown
Contributor

What

pa_to_athena_value_type in sdk/python/feast/type_map.py maps every
unsigned Arrow int (uint8/uint16/uint32/uint64) to Athena tinyint.
Athena tinyint is a signed 8-bit type (-128..127), so any unsigned value
above 127 — e.g. a uint32 column — overflows the type in the generated DDL.

This feeds real Athena CREATE TABLE DDL: aws_utils.py emits each column as
`{name}` {pa_to_athena_value_type(field.type)} when uploading a pyarrow
table.

Fix

Widen each unsigned type to the next-larger signed Athena type that holds its
full range (Athena has no unsigned integer types):

Arrow before after
uint8 tinyint smallint
uint16 tinyint int
uint32 tinyint bigint
uint64 tinyint bigint

Same widening already used for Postgres by arrow_to_pg_type in this module —
the right sibling since both targets use signed integers. (pa_to_mssql_type
keeps uint8->tinyint only because SQL Server's tinyint is unsigned.)
Signed inputs are unchanged.

Test

Regression test in sdk/python/tests/unit/test_type_map.py. Before the fix it
fails (assert 'tinyint' == 'smallint'); after, both new cases pass (2 passed).


drafted with AI assistance; verified locally (red -> green on the added test).

pa_to_athena_value_type mapped every unsigned Arrow int (uint8/16/32/64)
to Athena tinyint, a signed 8-bit type (-128..127). Any unsigned value
above 127 (e.g. a uint32 column) overflows the type in the generated
CREATE TABLE DDL built by aws_utils.py.

Widen each unsigned type to the next-larger signed Athena type, matching
the widening already used for Postgres in arrow_to_pg_type in this module
(uint8->smallint, uint16->int, uint32/uint64->bigint). Signed inputs are
unchanged. Adds a regression test for both the widened and signed cases.

Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.81%. Comparing base (a9219d9) to head (22d0661).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6739   +/-   ##
=======================================
  Coverage   46.80%   46.81%           
=======================================
  Files         415      415           
  Lines       50395    50395           
  Branches     7214     7214           
=======================================
+ Hits        23588    23591    +3     
+ Misses      25155    25145   -10     
- Partials     1652     1659    +7     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 48.13% <ø> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/type_map.py 62.56% <ø> (+0.36%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9219d9...22d0661. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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