You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "QuenKar (via GitHub)" <gi...@apache.org> on 2023/12/04 08:08:42 UTC

[I] String cast to decimal looks strange [arrow-datafusion]

QuenKar opened a new issue, #8326:
URL: https://github.com/apache/arrow-datafusion/issues/8326

   ### Describe the bug
   
   datafusion-cli
   ```sql
   // Negative number is weird
   ❯ select '-1.23499999'::DECIMAL(4,3);
   +---------------------+
   | Utf8("-1.23499999") |
   +---------------------+
   | -0.765              |
   +---------------------+
   1 row in set. Query took 0.032 seconds.
   
   // Normal
   ❯ select '1.23499999'::DECIMAL(4,3);
   +--------------------+
   | Utf8("1.23499999") |
   +--------------------+
   | 1.235              |
   +--------------------+
   
   // float to decimal is also right
   ❯ select -1.23499999::DECIMAL(4,3);
   +-------------------------+
   | (- Float64(1.23499999)) |
   +-------------------------+
   | -1.235                  |
   +-------------------------+
   ```
   I also try it in duckdb
   ```
   D select '-1.23499999'::DECIMAL(4,3);
   ┌─────────────────────────────────────┐
   │ CAST('-1.23499999' AS DECIMAL(4,3)) │
   │            decimal(4,3)             │
   ├─────────────────────────────────────┤
   │                              -1.235 │
   └─────────────────────────────────────┘
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] String cast to decimal looks strange [arrow-datafusion]

Posted by "QuenKar (via GitHub)" <gi...@apache.org>.
QuenKar closed issue #8326: String cast to decimal looks strange
URL: https://github.com/apache/arrow-datafusion/issues/8326


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] String cast to decimal looks strange [arrow-datafusion]

Posted by "QuenKar (via GitHub)" <gi...@apache.org>.
QuenKar commented on issue #8326:
URL: https://github.com/apache/arrow-datafusion/issues/8326#issuecomment-1833401690

   I find this has been fixed by https://github.com/apache/arrow-rs/pull/5128


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] String cast to decimal looks strange [arrow-datafusion]

Posted by "QuenKar (via GitHub)" <gi...@apache.org>.
QuenKar closed issue #8326: String cast to decimal looks strange
URL: https://github.com/apache/arrow-datafusion/issues/8326


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] String cast to decimal looks strange [arrow-datafusion]

Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on issue #8326:
URL: https://github.com/apache/arrow-datafusion/issues/8326#issuecomment-1827533872

   It should be an issue with arrow-rs 
   [fn parse_string_to_decimal_native<T: DecimalType>(](https://github.com/apache/arrow-rs/blob/df69ef57d055453c399fa925ad315d19211d7ab2/arrow-cast/src/cast.rs#L2629-L2632)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org