Skip to content

Commit 5a704cf

Browse files
authored
Revert "Convert into arrow without going via into_canonical" (#1797)
Reverts #1736
1 parent a5c7a9a commit 5a704cf

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

docs/guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ If you have a struct array, use :meth:`.Array.to_arrow_table` to construct an Ar
9191
>>> struct_vtx.to_arrow_table()
9292
pyarrow.Table
9393
age: int64
94-
name: string
94+
name: string_view
9595
----
9696
age: [[25,31,33,57]]
9797
name: [["Joseph","Narendra","Angela","Mikhail"]]
@@ -116,7 +116,7 @@ Pandas
116116
>>> vortex.array(df).to_arrow_table()
117117
pyarrow.Table
118118
age: int64
119-
name: string
119+
name: string_view
120120
----
121121
age: [[25,31,33,57]]
122122
name: [["Joseph","Narendra","Angela","Mikhail"]]

pyvortex/python/vortex/encoding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _Array_to_arrow_table(self: _encoding.Array) -> pyarrow.Table:
7171
>>> array.to_arrow_table()
7272
pyarrow.Table
7373
age: int64
74-
name: string
74+
name: string_view
7575
----
7676
age: [[25,31,33,57]]
7777
name: [["Joseph","Narendra","Angela","Mikhail"]]
@@ -357,7 +357,7 @@ def array(obj: pyarrow.Array | list | Any) -> Array:
357357
<pyarrow.lib.ChunkedArray object at ...>
358358
[
359359
-- is_valid: all not null
360-
-- child 0 type: string
360+
-- child 0 type: string_view
361361
[
362362
"Braund",
363363
"Allen",

pyvortex/src/expr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::dtype::PyDType;
3838
/// [
3939
/// 57
4040
/// ]
41-
/// -- child 1 type: string
41+
/// -- child 1 type: string_view
4242
/// [
4343
/// "Mikhail"
4444
/// ]
@@ -56,7 +56,7 @@ use crate::dtype::PyDType;
5656
/// 25,
5757
/// 31
5858
/// ]
59-
/// -- child 1 type: string
59+
/// -- child 1 type: string_view
6060
/// [
6161
/// "Joseph",
6262
/// null
@@ -73,7 +73,7 @@ use crate::dtype::PyDType;
7373
/// [
7474
/// 25
7575
/// ]
76-
/// -- child 1 type: string
76+
/// -- child 1 type: string_view
7777
/// [
7878
/// "Joseph"
7979
/// ]
@@ -90,7 +90,7 @@ use crate::dtype::PyDType;
9090
/// null,
9191
/// 57
9292
/// ]
93-
/// -- child 1 type: string
93+
/// -- child 1 type: string_view
9494
/// [
9595
/// "Angela",
9696
/// "Mikhail"
@@ -110,7 +110,7 @@ use crate::dtype::PyDType;
110110
/// 25,
111111
/// null
112112
/// ]
113-
/// -- child 1 type: string
113+
/// -- child 1 type: string_view
114114
/// [
115115
/// "Joseph",
116116
/// "Angela"

pyvortex/src/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use crate::{PyArray, TOKIO_RUNTIME};
4848
/// 57,
4949
/// null
5050
/// ]
51-
/// -- child 1 type: string
51+
/// -- child 1 type: string_view
5252
/// [
5353
/// "Joseph",
5454
/// null,
@@ -78,7 +78,7 @@ use crate::{PyArray, TOKIO_RUNTIME};
7878
/// >>> d.to_arrow_array()
7979
/// <pyarrow.lib.StructArray object at ...>
8080
/// -- is_valid: all not null
81-
/// -- child 0 type: string
81+
/// -- child 0 type: string_view
8282
/// [
8383
/// "Joseph",
8484
/// null,
@@ -98,7 +98,7 @@ use crate::{PyArray, TOKIO_RUNTIME};
9898
/// [
9999
/// 57
100100
/// ]
101-
/// -- child 1 type: string
101+
/// -- child 1 type: string_view
102102
/// [
103103
/// "Mikhail"
104104
/// ]

vortex-array/src/arrow/record_batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl TryFrom<StructArray> for RecordBatch {
4949
type Error = VortexError;
5050

5151
fn try_from(value: StructArray) -> VortexResult<Self> {
52-
let array_ref = value.into_array().into_arrow()?;
52+
let array_ref = value.into_canonical()?.into_arrow()?;
5353
let struct_array = as_struct_array(array_ref.as_ref());
5454
Ok(Self::from(struct_array))
5555
}

vortex-array/src/canonical.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ fn struct_to_arrow(struct_array: StructArray) -> VortexResult<ArrayRef> {
201201
.iter()
202202
.zip(struct_array.children())
203203
.map(|(name, f)| {
204-
f.into_arrow()
204+
f.into_canonical()
205205
.map_err(|err| err.with_context(format!("Failed to canonicalize field {}", name)))
206+
.and_then(|c| c.into_arrow())
206207
})
207208
.collect::<VortexResult<Vec<_>>>()?;
208209

0 commit comments

Comments
 (0)