Skip to content

Commit 8781064

Browse files
authored
Use execute for random access (#5760)
Signed-off-by: Nicholas Gates <[email protected]>
1 parent 06f0956 commit 8781064

File tree

1 file changed

+12
-5
lines changed
  • bench-vortex/src/random_access

1 file changed

+12
-5
lines changed

bench-vortex/src/random_access/take.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ use stream::StreamExt;
2525
use vortex::array::Array;
2626
use vortex::array::ArrayRef;
2727
use vortex::array::IntoArray;
28+
use vortex::array::VectorExecutor;
2829
use vortex::array::stream::ArrayStreamExt;
30+
use vortex::array::vectors::VectorIntoArray;
2931
use vortex::buffer::Buffer;
3032
use vortex::file::OpenOptionsSessionExt;
33+
use vortex::layout::layouts::USE_VORTEX_OPERATORS;
3134
use vortex::utils::aliases::hash_map::HashMap;
3235

3336
use crate::SESSION;
@@ -43,18 +46,22 @@ pub async fn take_vortex_tokio(
4346
}
4447

4548
async fn take_vortex(reader: impl AsRef<Path>, indices: Buffer<u64>) -> anyhow::Result<ArrayRef> {
46-
Ok(SESSION
49+
let array = SESSION
4750
.open_options()
4851
.open(reader.as_ref())
4952
.await?
5053
.scan()?
5154
.with_row_indices(indices)
5255
.into_array_stream()?
5356
.read_all()
54-
.await?
55-
// We canonicalize / decompress for equivalence to Arrow's `RecordBatch`es.
56-
.to_canonical()
57-
.into_array())
57+
.await?;
58+
59+
// We canonicalize / decompress for equivalence to Arrow's `RecordBatch`es.
60+
Ok(if *USE_VORTEX_OPERATORS {
61+
array.execute_vector(&SESSION)?.into_array(array.dtype())
62+
} else {
63+
array.to_canonical().into_array()
64+
})
5865
}
5966

6067
pub async fn take_parquet(path: &Path, indices: Buffer<u64>) -> anyhow::Result<RecordBatch> {

0 commit comments

Comments
 (0)