NUMERIC reads: full digits arrive, the decode drops them
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start in src/crate/client/http.py at line 244 and reproduce the NUMERIC example against CrateDB 6.4.2. Compare the current orjson decode with stdlib json.loads using parse_float=Decimal, then determine how a connection option should expose exact numeric reads while preserving existing float behavior; done means the reported digits are retained and the option is covered by verification.
Written by the indexing model from the issue text.
Description
The read-side follow-up promised in crate/sqlalchemy-cratedb#300, with the measurement #652 was missing. As @matriv said there, the full number reaches the client; the digits are dropped by this driver's decode.
On CrateDB 6.4.2, with 1.234567890123456789012345 stored in a NUMERIC(38, 24) column, the raw /_sql response carries every digit:
{"cols":["n"],"rows":[[1.234567890123456789012345]],"rowcount":1,"duration":105.078}
cursor.fetchone()[0] on the same query returns 1.2345678901234567, a float. The response is decoded with orjson.loads (http.py line 244), which parses every JSON number to a float64 and has no parse_float hook; stdlib json.loads(raw, parse_float=Decimal) on those bytes returns Decimal('1.234567890123456789012345').
Writes are already exact, since Decimal goes out as a string (#751). A stdlib decode with parse_float=Decimal would make reads match, but it changes the returned type for every float column and gives up orjson's speed, so it likely wants to be a connection option rather than the default.
- Dominant language
- Python
- Stars
- 85
- Forks
- 34
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from crate/crate-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
crate/crate-python#794 · 2 comments ·
-
enhancement
crate/crate-python#833 · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
crate/crate-python#820 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
crate/crate-python#751 · 7 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
crate/crate-python#729 · 1 comment ·
All issues in crate/crate-python
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·