kaskada
kaskada copied to clipboard
bug: type mismatch when creating record
When creating a record and casting the types inside to i64
, I get an error saying it expected i64
but got i32
.
Test:
#[tokio::test]
async fn test_lt_interval() {
insta::assert_snapshot!(QueryFixture::new("
let time = time_of(Times)
let lag_time = time_of(Times) | lag(1)
let days_between = days_between(time, lag_time)
let months_between = months_between(time, lag_time)
in { d: days_between as i64, m : months_between as i64 }
").run_to_csv(×tamp_ns_data_fixture().await).await.unwrap(), @r###"
_time,_subsort,_key_hash,_key,m,n,lt
"###);
}
Error:
thread 'comparison_tests::test_lt_interval' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidArgumentError("Incorrect datatype for StructArray field \"m\", expected Int64 got Int32")', /Users/jordan.frazier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-array-43.0.0/src/array/struct_array.rs:90:46
Notes:
- Using
as i32
instead ofas i64
works as expected. - You can do
(x as i32) as i64
- Without the cast, it produces the display format of durations (which is why for human-readable format we want the cast)
Which one is x
in x as i32
? I believe that one of those only supports casting to i32
, but I could be wrong. It's weird how the error is being reported against the struct though...
Which one is
x
inx as i32
? I believe that one of those only supports casting toi32
, but I could be wrong. It's weird how the error is being reported against the struct though...
Either can use as i32
to correctly produce output.