Skip to content

Commit fdf4da4

Browse files
committed
dont use deprecated fn
Signed-off-by: Baris Palaska <barispalaska@gmail.com>
1 parent adf81da commit fdf4da4

32 files changed

Lines changed: 354 additions & 141 deletions

File tree

encodings/parquet-variant/src/array.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use vortex_array::ArrayParts;
1414
use vortex_array::ArrayRef;
1515
use vortex_array::ExecutionCtx;
1616
use vortex_array::IntoArray;
17+
use vortex_array::LEGACY_SESSION;
1718
use vortex_array::TypedArrayRef;
1819
use vortex_array::arrays::VariantArray;
1920
use vortex_array::arrow::ArrowArrayExecutor;
@@ -183,17 +184,32 @@ impl ParquetVariantData {
183184
}
184185
})
185186
.unwrap_or(Validity::NonNullable);
186-
let metadata =
187-
ArrayRef::from_arrow(arrow_variant.metadata_field() as &dyn ArrowArray, false)?;
187+
let metadata = ArrayRef::from_arrow_with_session(
188+
arrow_variant.metadata_field() as &dyn ArrowArray,
189+
false,
190+
&LEGACY_SESSION,
191+
)?;
188192

189193
let value = arrow_variant
190194
.value_field()
191-
.map(|v| ArrayRef::from_arrow(v as &dyn ArrowArray, value_nullable))
195+
.map(|v| {
196+
ArrayRef::from_arrow_with_session(
197+
v as &dyn ArrowArray,
198+
value_nullable,
199+
&LEGACY_SESSION,
200+
)
201+
})
192202
.transpose()?;
193203

194204
let typed_value = arrow_variant
195205
.typed_value_field()
196-
.map(|tv| ArrayRef::from_arrow(tv.as_ref(), typed_value_nullable))
206+
.map(|tv| {
207+
ArrayRef::from_arrow_with_session(
208+
tv.as_ref(),
209+
typed_value_nullable,
210+
&LEGACY_SESSION,
211+
)
212+
})
197213
.transpose()?;
198214

199215
let pv = ParquetVariant::try_new(validity, metadata, value, typed_value)?;

encodings/runend/src/arrow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ where
6969
}
7070

7171
#[cfg(test)]
72-
#[allow(deprecated)]
7372
mod tests {
7473
use std::sync::Arc;
7574
use std::sync::LazyLock;
@@ -131,7 +130,8 @@ mod tests {
131130
Buffer::<R::Native>::from_arrow_scalar_buffer(array.run_ends().inner().clone());
132131
let ends = PrimitiveArray::new(ends_buf, Validity::NonNullable)
133132
.reinterpret_cast(R::Native::PTYPE.to_unsigned());
134-
let values = ArrayRef::from_arrow(array.values().as_ref(), nullable)?;
133+
let values =
134+
ArrayRef::from_arrow_with_session(array.values().as_ref(), nullable, &SESSION)?;
135135

136136
let ends_array = PrimitiveArray::from_buffer_handle(
137137
ends.buffer_handle().clone(),

vortex-array/src/arrays/filter/execute/varbinview.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ fn arrow_filter_fn(array: &ArrayRef, mask: &Mask) -> vortex_error::VortexResult<
3737
let mask_array = BooleanArray::new(values.bit_buffer().clone().into(), None);
3838
let filtered = arrow_select::filter::filter(array_ref.as_ref(), &mask_array)?;
3939

40-
ArrayRef::from_arrow(filtered.as_ref(), array.dtype().is_nullable())
40+
ArrayRef::from_arrow_with_session(
41+
filtered.as_ref(),
42+
array.dtype().is_nullable(),
43+
&LEGACY_SESSION,
44+
)
4145
}
4246

4347
#[cfg(test)]

vortex-array/src/arrow/convert.rs

Lines changed: 212 additions & 83 deletions
Large diffs are not rendered by default.

vortex-array/src/arrow/datum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn from_arrow_array_with_len<A>(array: A, len: usize, nullable: bool) -> Vor
9393
where
9494
ArrayRef: FromArrowArray<A>,
9595
{
96-
let array = ArrayRef::from_arrow(array, nullable)?;
96+
let array = ArrayRef::from_arrow_with_session(array, nullable, &LEGACY_SESSION)?;
9797
if array.len() == len {
9898
return Ok(array);
9999
}

vortex-array/src/arrow/executor/byte_view.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ pub(super) fn to_arrow_byte_view<T: ByteViewType>(
7171
// We do this in case the vortex array is Utf8, and we want Binary or vice versa. By casting
7272
// first, we may push this down through the Vortex array tree. We choose nullable to be most
7373
// flexible since there's no prescribed nullability in Arrow types.
74-
let array = array.cast(DType::from_arrow((&T::DATA_TYPE, Nullability::Nullable)))?;
74+
let array = array.cast(DType::from_arrow_with_session(
75+
(&T::DATA_TYPE, Nullability::Nullable),
76+
ctx.session(),
77+
))?;
7578

7679
let varbinview = array.execute::<VarBinViewArray>(ctx)?;
7780
canonical_varbinview_to_arrow::<T>(&varbinview, ctx)

vortex-array/src/arrow/executor/struct_.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub(super) fn to_arrow_struct(
8686

8787
// Otherwise, we fall back to executing to a StructArray.
8888
let array = if let Some(fields) = target_fields {
89-
let vx_fields = StructFields::from_arrow(fields);
89+
let vx_fields = StructFields::from_arrow_with_session(fields, ctx.session());
9090
// We apply a cast to ensure we push down casting where possible into the struct fields.
9191
array.cast(DType::Struct(
9292
vx_fields,
@@ -351,7 +351,8 @@ mod tests {
351351
)?;
352352
let orig_dtype = array.dtype().clone();
353353
let arrow_array = array.into_array().execute_arrow(None, &mut ctx)?;
354-
let from_arrow = array::ArrayRef::from_arrow(arrow_array.as_ref(), false)?;
354+
let from_arrow =
355+
array::ArrayRef::from_arrow_with_session(arrow_array.as_ref(), false, ctx.session())?;
355356
assert_eq!(&orig_dtype, from_arrow.dtype());
356357
Ok(())
357358
}

vortex-array/src/arrow/iter.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use vortex_error::VortexError;
66
use vortex_error::VortexResult;
77

88
use crate::ArrayRef;
9+
use crate::LEGACY_SESSION;
910
use crate::arrow::FromArrowArray;
1011
use crate::dtype::DType;
1112
use crate::dtype::arrow::FromArrowType;
@@ -36,8 +37,11 @@ impl Iterator for ArrowArrayStreamAdapter {
3637
let batch = self.stream.next()?;
3738

3839
Some(batch.map_err(VortexError::from).and_then(|b| {
39-
debug_assert_eq!(&self.dtype, &DType::from_arrow(b.schema()));
40-
ArrayRef::from_arrow(b, false)
40+
debug_assert_eq!(
41+
&self.dtype,
42+
&DType::from_arrow_with_session(b.schema(), &LEGACY_SESSION)
43+
);
44+
ArrayRef::from_arrow_with_session(b, false, &LEGACY_SESSION)
4145
}))
4246
}
4347
}

vortex-array/src/arrow/record_batch.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ mod tests {
4747
use arrow_schema::FieldRef;
4848
use arrow_schema::Schema;
4949

50+
use crate::LEGACY_SESSION;
5051
use crate::arrow::record_batch::StructArray;
5152
use crate::builders::ArrayBuilder;
5253
use crate::builders::ListBuilder;
@@ -81,8 +82,9 @@ mod tests {
8182
DataType::LargeListView(FieldRef::new(Field::new_list_field(DataType::Int32, false))),
8283
true,
8384
)]));
84-
#[allow(deprecated)]
85-
let rb = array.into_record_batch_with_schema(arrow_schema).unwrap();
85+
let rb = array
86+
.into_record_batch_with_schema_with_session(arrow_schema, &LEGACY_SESSION)
87+
.unwrap();
8688

8789
let xs = rb.column(0);
8890
assert_eq!(

vortex-array/src/canonical.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,8 @@ mod test {
11651165
nulls.finish(),
11661166
);
11671167

1168-
let vortex_struct = ArrayRef::from_arrow(&arrow_struct, true).unwrap();
1168+
let vortex_struct =
1169+
ArrayRef::from_arrow_with_session(&arrow_struct, true, ctx.session()).unwrap();
11691170

11701171
assert_eq!(
11711172
&arrow_struct,
@@ -1193,7 +1194,8 @@ mod test {
11931194
);
11941195
let list_data_type = arrow_list.data_type();
11951196

1196-
let vortex_list = ArrayRef::from_arrow(&arrow_list, true).unwrap();
1197+
let vortex_list =
1198+
ArrayRef::from_arrow_with_session(&arrow_list, true, ctx.session()).unwrap();
11971199

11981200
let rt_arrow_list = vortex_list
11991201
.execute_arrow(Some(list_data_type), &mut ctx)

0 commit comments

Comments
 (0)