New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String to HUGEINT cast bug #5328
Comments
This comment was marked as abuse.
This comment was marked as abuse.
Seems to be caused on the first run of
and after:
Note: this is not me assigning myself, just got curious and thought I'd share some seemingly useful findings ;) |
I tested it with duckdb> select '1.8259857912588366e4'::int;
┌─────────────────────────────────────────┐
│ CAST('1.8259857912588366e4' AS INTEGER) │
╞═════════════════════════════════════════╡
│ 20000 │
└─────────────────────────────────────────┘ So I think the cause is that duckdb/src/common/operator/cast_operators.cpp Lines 884 to 892 in 0f04611
IntegerCastLoop calls generic HandleDecimal here.
If no one has started on it, I will try fixing it later. |
Hmm that sounds likely, DECIMAL had a similar issue, maybe have a look at how it's handled there - or if you can come up with a nicer solution, that's even better :) |
I looked at duckdb/src/common/operator/cast_operators.cpp Lines 1594 to 1617 in 0f04611
duckdb/src/common/operator/cast_operators.cpp Lines 1677 to 1697 in 0f04611
Later it adjusts scale and decides whether to round up or down if needed. Maybe this logic can be reused in |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
What happens?
Casting from string to hugeint behaves incorrect.
To Reproduce
But this works.
OS:
iOS
DuckDB Version:
master
DuckDB Client:
CLI
Full Name:
Tania Bogatsch
Affiliation:
DuckDB Labs
Have you tried this on the latest
master
branch?Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
The text was updated successfully, but these errors were encountered: