We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While working on upgrading to DF 43 I discovered that casting support for utf8view <-> bool has not been implemented
Describe the solution you'd like
Support casting to/from bool with utf8view's
Additional context
arrow-cast/src/cast/mod.rs
#[test] fn test_cast_utf8view_to_bool() { let strings = StringViewArray::from(vec!["true", "false", "invalid", " Y ", ""]); let casted = cast(&strings, &DataType::Boolean).unwrap(); let expected = BooleanArray::from(vec![Some(true), Some(false), None, Some(true), None]); assert_eq!(*as_boolean_array(&casted), expected); } #[test] fn test_cast_with_options_utf8view_to_bool() { let strings = StringViewArray::from(vec!["true", "false", "invalid", " Y ", ""]); let casted = cast_with_options( &strings, &DataType::Boolean, &CastOptions { safe: false, format_options: FormatOptions::default(), }, ); match casted { Ok(_) => panic!("expected error"), Err(e) => { assert!(e .to_string() .contains("Cast error: Cannot cast value 'invalid' to value of Boolean type")) } } } #[test] fn test_cast_bool_to_utf8view() { let array = BooleanArray::from(vec![Some(true), Some(false), None]); let b = cast(&array, &DataType::Utf8View).unwrap(); let c = b.as_any().downcast_ref::<StringViewArray>().unwrap(); assert_eq!("true", c.value(0)); assert_eq!("false", c.value(1)); assert!(!c.is_valid(2)); }
The text was updated successfully, but these errors were encountered:
take
Sorry, something went wrong.
tlm365
No branches or pull requests
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While working on upgrading to DF 43 I discovered that casting support for utf8view <-> bool has not been implemented
Describe the solution you'd like
Support casting to/from bool with utf8view's
Additional context
arrow-cast/src/cast/mod.rs
The text was updated successfully, but these errors were encountered: