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
@@ -8653,7 +8653,7 @@ mod tests {
8653
8653
};
8654
8654
assert_eq!(
8655
8655
t,
8656
-
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"#
8656
+
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"#
8657
8657
);
8658
8658
}
8659
8659
@@ -8704,7 +8704,7 @@ mod tests {
8704
8704
};
8705
8705
assert_eq!(
8706
8706
t,
8707
-
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"#
8707
+
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"#
8708
8708
);
8709
8709
}
8710
8710
@@ -10796,7 +10796,7 @@ mod tests {
10796
10796
let to_type = DataType::Utf8;
10797
10797
let result = cast(&struct_array,&to_type);
10798
10798
assert_eq!(
10799
-
r#"Cast error: Casting from Struct(a Boolean) to Utf8 not supported"#,
10799
+
r#"Cast error: Casting from Struct("a": Boolean) to Utf8 not supported"#,
10800
10800
result.unwrap_err().to_string()
10801
10801
);
10802
10802
}
@@ -10807,7 +10807,7 @@ mod tests {
10807
10807
let to_type = DataType::Struct(vec![Field::new("a",DataType::Boolean,false)].into());
10808
10808
let result = cast(&array,&to_type);
10809
10809
assert_eq!(
10810
-
r#"Cast error: Casting from Utf8 to Struct(a Boolean) not supported"#,
10810
+
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