You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Weijun-H (via GitHub)" <gi...@apache.org> on 2023/11/27 10:26:02 UTC

[I] cast `Utf8` to negative decimal failure [arrow-rs]

Weijun-H opened a new issue, #5127:
URL: https://github.com/apache/arrow-rs/issues/5127

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ``` rust
       #[test]
       fn test() {
           let array = LargeStringArray::from(vec![Some("-0.12345")]);
   
           // Decimal128
           let output_type = DataType::Decimal128(38, 2);
           assert!(can_cast_types(array.data_type(), &output_type));
   
           let casted_array = cast(&array, &output_type).unwrap();
           let decimal_arr = casted_array.as_primitive::<Decimal128Type>();
   
           assert_eq!("-0.12", decimal_arr.value_as_string(0));
   
           // Decimal256
           let output_type = DataType::Decimal256(76, 3);
           assert!(can_cast_types(array.data_type(), &output_type));
   
           let casted_array = cast(&array, &output_type).unwrap();
           let decimal_arr = casted_array.as_primitive::<Decimal256Type>();
   
           assert_eq!("-0.123.", decimal_arr.value_as_string(0));
       }
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   pass the test
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   #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.apache.org

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


Re: [I] cast `Utf8` to decimal failure [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #5127:  cast `Utf8` to decimal failure
URL: https://github.com/apache/arrow-rs/issues/5127


-- 
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] cast `Utf8` to decimal failure [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #5127:
URL: https://github.com/apache/arrow-rs/issues/5127#issuecomment-1827576155

   Looks like this is adding `1` instead of `-1` when combining the decimal and numeric components


-- 
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] cast `Utf8` to decimal failure [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #5127:
URL: https://github.com/apache/arrow-rs/issues/5127#issuecomment-1878523088

   `label_issue.py` automatically added labels {'arrow'} from #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