Skip to content

Commit d5fbeb3

Browse files
joostboonclaude
andcommitted
fix: handle Vertica Decimal special values (Infinity/NaN) in query runner
Vertica's adapter returns Decimal special values where as_tuple().exponent is a string ('F'/'n') instead of int, causing a TypeError on comparison. Cherry-picked from worktree-fix-dimension-alerts (0eecf7d). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 605bdd0 commit d5fbeb3

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

integration_tests/tests/adapter_query_runner.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ def _serialize_value(val: Any) -> Any:
5252
* Everything else is returned unchanged.
5353
"""
5454
if isinstance(val, Decimal):
55-
# Match the Jinja macro: normalize, then int or float
55+
# Match the Jinja macro: normalize, then int or float.
56+
# Note: for special values (Infinity, NaN), as_tuple().exponent is a
57+
# string ('F' or 'n'), not an int — convert those directly to float.
5658
normalized = val.normalize()
57-
if normalized.as_tuple().exponent >= 0:
59+
exponent = normalized.as_tuple().exponent
60+
if isinstance(exponent, str):
61+
return float(normalized)
62+
if exponent >= 0:
5863
return int(normalized)
5964
return float(normalized)
6065
if isinstance(val, (datetime, date, time)):

0 commit comments

Comments
 (0)