You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: arrow-cast/src/cast/mod.rs
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8605,7 +8605,7 @@ mod tests {
8605
8605
};
8606
8606
assert_eq!(
8607
8607
t,
8608
-
r#"Casting from Map(Field { "entries": Struct(key Utf8, value nullable Utf8) }, false) to Map(Field { "entries": Struct(key Utf8, value Utf8) }, true) not supported"#
8608
+
r#"Casting from Map(Field { "entries": Struct("key": Utf8, "value": nullable Utf8) }, false) to Map(Field { "entries": Struct("key": Utf8, "value": Utf8) }, true) not supported"#
8609
8609
);
8610
8610
}
8611
8611
@@ -8656,7 +8656,7 @@ mod tests {
8656
8656
};
8657
8657
assert_eq!(
8658
8658
t,
8659
-
r#"Casting from Map(Field { "entries": Struct(key Utf8, value nullable Interval(DayTime)) }, false) to Map(Field { "entries": Struct(key Utf8, value Duration(Second)) }, true) not supported"#
8659
+
r#"Casting from Map(Field { "entries": Struct("key": Utf8, "value": nullable Interval(DayTime)) }, false) to Map(Field { "entries": Struct("key": Utf8, "value": Duration(Second)) }, true) not supported"#
8660
8660
);
8661
8661
}
8662
8662
@@ -10748,7 +10748,7 @@ mod tests {
10748
10748
let to_type = DataType::Utf8;
10749
10749
let result = cast(&struct_array,&to_type);
10750
10750
assert_eq!(
10751
-
r#"Cast error: Casting from Struct(a Boolean) to Utf8 not supported"#,
10751
+
r#"Cast error: Casting from Struct("a": Boolean) to Utf8 not supported"#,
10752
10752
result.unwrap_err().to_string()
10753
10753
);
10754
10754
}
@@ -10759,7 +10759,7 @@ mod tests {
10759
10759
let to_type = DataType::Struct(vec![Field::new("a",DataType::Boolean,false)].into());
10760
10760
let result = cast(&array,&to_type);
10761
10761
assert_eq!(
10762
-
r#"Cast error: Casting from Utf8 to Struct(a Boolean) not supported"#,
10762
+
r#"Cast error: Casting from Utf8 to Struct("a": Boolean) not supported"#,
("Timestamp(Nanosecond, ","Error finding next token"),
860
866
(
@@ -876,9 +882,9 @@ mod test {
876
882
("Decimal64(3, 500)","Error converting 500 into i8 for Decimal64: out of range integral type conversion attempted"),
877
883
("Decimal128(3, 500)","Error converting 500 into i8 for Decimal128: out of range integral type conversion attempted"),
878
884
("Decimal256(3, 500)","Error converting 500 into i8 for Decimal256: out of range integral type conversion attempted"),
879
-
("Struct(f1, Int64)","Error finding next type, got unexpected ','"),
880
-
("Struct(f1 Int64,)","Expected a word for the name of Struct, but got trailing comma"),
881
-
("Struct(f1)","Error finding next type, got unexpected ')'"),
885
+
("Struct(f1 Int64)","Error unknown token: f1"),
886
+
("Struct(\"f1\" Int64)","Expected ':'"),
887
+
("Struct(\"f1\": )","Error finding next type, got unexpected ')'"),
882
888
];
883
889
884
890
for(data_type_string, expected_message)in cases {
@@ -889,10 +895,13 @@ mod test {
889
895
let message = e.to_string();
890
896
assert!(
891
897
message.contains(expected_message),
892
-
"\n\ndid not find expected in actual.\n\nexpected: {expected_message}\nactual:{message}\n"
898
+
"\n\ndid not find expected in actual.\n\nexpected: {expected_message}\nactual:{message}\n"
893
899
);
894
-
// errors should also contain a help message
895
-
assert!(message.contains("Must be a supported arrow type name such as 'Int32' or 'Timestamp(Nanosecond, None)'"));
900
+
901
+
if !message.contains("Unterminated string"){
902
+
// errors should also contain a help message
903
+
assert!(message.contains("Must be a supported arrow type name such as 'Int32' or 'Timestamp(Nanosecond, None)'"),"message: {message}");
904
+
}
896
905
}
897
906
}
898
907
}
@@ -902,6 +911,6 @@ mod test {
902
911
fnparse_error_type(){
903
912
let err = parse_data_type("foobar").unwrap_err();
904
913
assert!(matches!(err,ArrowError::ParseError(_)));
905
-
assert_eq!(err.to_string(),"Parser error: Unsupported type 'foobar'. Must be a supported arrow type name such as 'Int32' or 'Timestamp(Nanosecond, None)'. Error unrecognized word: foobar");
914
+
assert_eq!(err.to_string(),"Parser error: Unsupported type 'foobar'. Must be a supported arrow type name such as 'Int32' or 'Timestamp(Nanosecond, None)'. Error unknown token: foobar");
0 commit comments