Skip to content

Commit e84f4ff

Browse files
authored
Avoid creating errors when converting Arrow DataType to Vortex DType (#2235)
1 parent bd576fd commit e84f4ff

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vortex-array/src/arrow/dtype.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use arrow_schema::{DataType, Field, FieldRef, Fields, Schema, SchemaBuilder, Sch
1616
use vortex_datetime_dtype::arrow::{make_arrow_temporal_dtype, make_temporal_ext_dtype};
1717
use vortex_datetime_dtype::is_temporal_ext_type;
1818
use vortex_dtype::{DType, FieldName, Nullability, PType, StructDType};
19-
use vortex_error::{vortex_bail, vortex_err, VortexResult};
19+
use vortex_error::{vortex_bail, vortex_err, VortexExpect, VortexResult};
2020

2121
use crate::arrow::{FromArrowType, TryFromArrowType};
2222

@@ -68,8 +68,12 @@ impl FromArrowType<&Field> for DType {
6868

6969
let nullability: Nullability = field.is_nullable().into();
7070

71-
if let Ok(ptype) = PType::try_from_arrow(field.data_type()) {
72-
return Primitive(ptype, nullability);
71+
if field.data_type().is_integer() || field.data_type().is_floating() {
72+
return Primitive(
73+
PType::try_from_arrow(field.data_type())
74+
.vortex_expect("arrow float/integer to ptype"),
75+
nullability,
76+
);
7377
}
7478

7579
match field.data_type() {

0 commit comments

Comments
 (0)