Skip to content

Commit c31ae9d

Browse files
authored
Rename Array -> ArrayData (#1316)
:)
1 parent 7585509 commit c31ae9d

File tree

216 files changed

+1124
-1052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+1124
-1052
lines changed

bench-vortex/benches/bytes_at.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use vortex::dtype::{DType, Nullability};
1313
use vortex::ipc::stream_reader::StreamArrayReader;
1414
use vortex::ipc::stream_writer::StreamArrayWriter;
1515
use vortex::validity::Validity;
16-
use vortex::{Context, IntoArray, IntoCanonical};
16+
use vortex::{Context, IntoArrayData, IntoCanonical};
1717

1818
fn array_data_fixture() -> VarBinArray {
1919
VarBinArray::try_new(

bench-vortex/benches/compress_noci.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use vortex::error::VortexResult;
3333
use vortex::file::{LayoutContext, LayoutDeserializer, VortexFileWriter, VortexReadBuilder};
3434
use vortex::sampling_compressor::compressors::fsst::FSSTCompressor;
3535
use vortex::sampling_compressor::{SamplingCompressor, ALL_ENCODINGS_CONTEXT};
36-
use vortex::{Array, ArrayDType, IntoArray, IntoCanonical};
36+
use vortex::{ArrayDType, ArrayData, IntoArrayData, IntoCanonical};
3737

3838
use crate::tokio_runtime::TOKIO_RUNTIME;
3939

@@ -100,7 +100,7 @@ fn parquet_decompress_read(buf: bytes::Bytes) -> usize {
100100
nbytes
101101
}
102102

103-
fn parquet_compressed_written_size(array: &Array, compression: Compression) -> usize {
103+
fn parquet_compressed_written_size(array: &ArrayData, compression: Compression) -> usize {
104104
let chunked = ChunkedArray::try_from(array).unwrap();
105105
let (batches, schema) = chunked_to_vec_record_batch(chunked);
106106
parquet_compress_write(batches, schema, compression, &mut Vec::new())
@@ -109,10 +109,10 @@ fn parquet_compressed_written_size(array: &Array, compression: Compression) -> u
109109
fn vortex_compress_write(
110110
runtime: &Runtime,
111111
compressor: &SamplingCompressor<'_>,
112-
array: &Array,
112+
array: &ArrayData,
113113
buf: &mut Vec<u8>,
114114
) -> VortexResult<u64> {
115-
async fn async_write(array: &Array, cursor: &mut Cursor<&mut Vec<u8>>) -> VortexResult<()> {
115+
async fn async_write(array: &ArrayData, cursor: &mut Cursor<&mut Vec<u8>>) -> VortexResult<()> {
116116
let mut writer = VortexFileWriter::new(cursor);
117117

118118
writer = writer.write_array_columns(array.clone()).await?;
@@ -129,7 +129,7 @@ fn vortex_compress_write(
129129
}
130130

131131
fn vortex_decompress_read(runtime: &Runtime, buf: Buffer) -> VortexResult<ArrayRef> {
132-
async fn async_read(buf: Buffer) -> VortexResult<Array> {
132+
async fn async_read(buf: Buffer) -> VortexResult<ArrayData> {
133133
let builder: VortexReadBuilder<_> = VortexReadBuilder::new(
134134
buf,
135135
LayoutDeserializer::new(
@@ -140,7 +140,7 @@ fn vortex_decompress_read(runtime: &Runtime, buf: Buffer) -> VortexResult<ArrayR
140140

141141
let stream = builder.build().await?;
142142
let dtype = stream.dtype().clone();
143-
let vecs: Vec<Array> = stream.try_collect().await?;
143+
let vecs: Vec<ArrayData> = stream.try_collect().await?;
144144

145145
ChunkedArray::try_new(vecs, dtype).map(|e| e.into())
146146
}
@@ -154,7 +154,7 @@ fn vortex_decompress_read(runtime: &Runtime, buf: Buffer) -> VortexResult<ArrayR
154154
fn vortex_compressed_written_size(
155155
runtime: &Runtime,
156156
compressor: &SamplingCompressor<'_>,
157-
array: &Array,
157+
array: &ArrayData,
158158
) -> VortexResult<u64> {
159159
vortex_compress_write(runtime, compressor, array, &mut Vec::new())
160160
}
@@ -168,7 +168,7 @@ fn benchmark_compress<F, U>(
168168
bench_name: &str,
169169
) where
170170
F: Fn() -> U,
171-
U: AsRef<Array>,
171+
U: AsRef<ArrayData>,
172172
{
173173
// if no logging is enabled, enable it
174174
if !LOG_INITIALIZED.swap(true, Ordering::SeqCst) {

bench-vortex/benches/compressor_throughput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use vortex::sampling_compressor::compressors::zigzag::ZigZagCompressor;
2424
use vortex::sampling_compressor::compressors::CompressorRef;
2525
use vortex::sampling_compressor::SamplingCompressor;
2626
use vortex::validity::Validity;
27-
use vortex::{IntoArray as _, IntoCanonical};
27+
use vortex::{IntoArrayData as _, IntoCanonical};
2828

2929
#[global_allocator]
3030
static GLOBAL: MiMalloc = MiMalloc;

bench-vortex/benches/datafusion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use vortex::sampling_compressor::compressors::dict::DictCompressor;
2222
use vortex::sampling_compressor::compressors::r#for::FoRCompressor;
2323
use vortex::sampling_compressor::compressors::CompressorRef;
2424
use vortex::sampling_compressor::SamplingCompressor;
25-
use vortex::{Array, Context};
25+
use vortex::{ArrayData, Context};
2626
use vortex_datafusion::memory::{VortexMemTable, VortexMemTableOptions};
2727

2828
pub static CTX: LazyLock<Context> = LazyLock::new(|| {
@@ -79,7 +79,7 @@ fn toy_dataset_arrow() -> RecordBatch {
7979
.unwrap()
8080
}
8181

82-
fn toy_dataset_vortex(compress: bool) -> Array {
82+
fn toy_dataset_vortex(compress: bool) -> ArrayData {
8383
let uncompressed = toy_dataset_arrow().try_into().unwrap();
8484

8585
if !compress {

bench-vortex/src/bin/notimplemented.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use vortex::runend_bool::RunEndBoolArray;
2424
use vortex::scalar::ScalarValue;
2525
use vortex::validity::Validity;
2626
use vortex::zigzag::ZigZagArray;
27-
use vortex::{Array, IntoArray};
27+
use vortex::{ArrayData, IntoArrayData};
2828

2929
const OPERATORS: [Operator; 6] = [
3030
Operator::Lte,
@@ -35,7 +35,7 @@ const OPERATORS: [Operator; 6] = [
3535
Operator::NotEq,
3636
];
3737

38-
fn fsst_array() -> Array {
38+
fn fsst_array() -> ArrayData {
3939
let input_array = varbin_array();
4040
let compressor = fsst_train_compressor(&input_array).unwrap();
4141

@@ -44,7 +44,7 @@ fn fsst_array() -> Array {
4444
.into_array()
4545
}
4646

47-
fn varbin_array() -> Array {
47+
fn varbin_array() -> ArrayData {
4848
let mut input_array = VarBinBuilder::<i32>::with_capacity(3);
4949
input_array.push_value(b"The Greeks never said that the limit could not be overstepped");
5050
input_array.push_value(
@@ -56,7 +56,7 @@ fn varbin_array() -> Array {
5656
.into_array()
5757
}
5858

59-
fn varbinview_array() -> Array {
59+
fn varbinview_array() -> ArrayData {
6060
VarBinViewArray::from_iter_str(vec![
6161
"The Greeks never said that the limit could not be overstepped",
6262
"They said it existed and that whoever dared to exceed it was mercilessly struck down",
@@ -65,7 +65,7 @@ fn varbinview_array() -> Array {
6565
.into_array()
6666
}
6767

68-
fn enc_impls() -> Vec<Array> {
68+
fn enc_impls() -> Vec<ArrayData> {
6969
vec![
7070
ALPArray::try_new(
7171
PrimitiveArray::from(vec![1]).into_array(),
@@ -175,7 +175,7 @@ fn bool_to_cell(val: bool) -> Cell {
175175
Cell::new(if val { "✓" } else { "𐄂" }).style_spec(style)
176176
}
177177

178-
fn compute_funcs(encodings: &[Array]) {
178+
fn compute_funcs(encodings: &[ArrayData]) {
179179
let mut table = Table::new();
180180
table.add_row(Row::new(
181181
vec![
@@ -214,7 +214,7 @@ fn compute_funcs(encodings: &[Array]) {
214214
table.printstd();
215215
}
216216

217-
fn compare_funcs(encodings: &[Array]) {
217+
fn compare_funcs(encodings: &[ArrayData]) {
218218
for arr in encodings {
219219
println!("\nArray {} compare functions", arr.encoding().id().as_ref());
220220
let mut table = Table::new();

bench-vortex/src/data_downloads.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use vortex::dtype::DType;
1515
use vortex::error::{VortexError, VortexResult};
1616
use vortex::io::TokioAdapter;
1717
use vortex::ipc::stream_writer::StreamArrayWriter;
18-
use vortex::{Array, IntoArray};
18+
use vortex::{ArrayData, IntoArrayData};
1919

2020
use crate::idempotent;
2121
use crate::reader::BATCH_SIZE;
@@ -46,7 +46,7 @@ pub fn data_vortex_uncompressed(fname_out: &str, downloaded_data: PathBuf) -> Pa
4646
let array = ChunkedArray::try_new(
4747
reader
4848
.into_iter()
49-
.map(|batch_result| Array::try_from(batch_result.unwrap()).unwrap())
49+
.map(|batch_result| ArrayData::try_from(batch_result.unwrap()).unwrap())
5050
.collect(),
5151
dtype,
5252
)
@@ -92,7 +92,7 @@ pub fn decompress_bz2(input_path: PathBuf, output_path: PathBuf) -> PathBuf {
9292

9393
pub trait BenchmarkDataset {
9494
fn as_uncompressed(&self);
95-
fn to_vortex_array(&self) -> VortexResult<Array>;
95+
fn to_vortex_array(&self) -> VortexResult<ArrayData>;
9696
fn compress_to_vortex(&self) -> VortexResult<()>;
9797
fn write_as_parquet(&self);
9898
fn write_as_vortex(&self) -> impl Future<Output = ()>;

bench-vortex/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use vortex::compress::CompressionStrategy;
1717
use vortex::dtype::DType;
1818
use vortex::fastlanes::DeltaEncoding;
1919
use vortex::sampling_compressor::SamplingCompressor;
20-
use vortex::{Array, Context, IntoArray};
20+
use vortex::{ArrayData, Context, IntoArrayData};
2121

2222
use crate::data_downloads::FileType;
2323
use crate::reader::BATCH_SIZE;
@@ -124,7 +124,7 @@ pub fn setup_logger(level: LevelFilter) {
124124
.unwrap();
125125
}
126126

127-
pub fn fetch_taxi_data() -> Array {
127+
pub fn fetch_taxi_data() -> ArrayData {
128128
let file = File::open(taxi_data_parquet()).unwrap();
129129
let builder = ParquetRecordBatchReaderBuilder::try_new(file).unwrap();
130130
let reader = builder.with_batch_size(BATCH_SIZE).build().unwrap();
@@ -134,7 +134,7 @@ pub fn fetch_taxi_data() -> Array {
134134
reader
135135
.into_iter()
136136
.map(|batch_result| batch_result.unwrap())
137-
.map(Array::try_from)
137+
.map(ArrayData::try_from)
138138
.map(Result::unwrap)
139139
.collect_vec(),
140140
DType::from_arrow(schema),
@@ -143,7 +143,7 @@ pub fn fetch_taxi_data() -> Array {
143143
.into_array()
144144
}
145145

146-
pub fn compress_taxi_data() -> Array {
146+
pub fn compress_taxi_data() -> ArrayData {
147147
CompressionStrategy::compress(&SamplingCompressor::default(), &fetch_taxi_data()).unwrap()
148148
}
149149

@@ -201,7 +201,7 @@ mod test {
201201
use vortex::arrow::FromArrowArray;
202202
use vortex::compress::CompressionStrategy;
203203
use vortex::sampling_compressor::SamplingCompressor;
204-
use vortex::{Array, IntoCanonical};
204+
use vortex::{ArrayData, IntoCanonical};
205205

206206
use crate::taxi_data::taxi_data_parquet;
207207
use crate::{compress_taxi_data, setup_logger};
@@ -223,7 +223,7 @@ mod test {
223223
for record_batch in reader.map(|batch_result| batch_result.unwrap()) {
224224
let struct_arrow: ArrowStructArray = record_batch.into();
225225
let arrow_array: ArrowArrayRef = Arc::new(struct_arrow);
226-
let vortex_array = Array::from_arrow(arrow_array.clone(), false);
226+
let vortex_array = ArrayData::from_arrow(arrow_array.clone(), false);
227227
let vortex_as_arrow = vortex_array.into_canonical().unwrap().into_arrow().unwrap();
228228
assert_eq!(vortex_as_arrow.deref(), arrow_array.deref());
229229
}
@@ -242,7 +242,7 @@ mod test {
242242
for record_batch in reader.map(|batch_result| batch_result.unwrap()) {
243243
let struct_arrow: ArrowStructArray = record_batch.into();
244244
let arrow_array: ArrowArrayRef = Arc::new(struct_arrow);
245-
let vortex_array = Array::from_arrow(arrow_array.clone(), false);
245+
let vortex_array = ArrayData::from_arrow(arrow_array.clone(), false);
246246

247247
let compressed = compressor.compress(&vortex_array).unwrap();
248248
let compressed_as_arrow = compressed.into_canonical().unwrap().into_arrow().unwrap();

bench-vortex/src/public_bi_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tokio::fs::File;
1313
use vortex::aliases::hash_map::HashMap;
1414
use vortex::array::ChunkedArray;
1515
use vortex::error::VortexResult;
16-
use vortex::{Array, ArrayDType, IntoArray};
16+
use vortex::{ArrayDType, ArrayData, IntoArrayData};
1717

1818
use crate::data_downloads::{decompress_bz2, download_data, BenchmarkDataset, FileType};
1919
use crate::public_bi_data::PBIDataset::*;
@@ -555,7 +555,7 @@ impl BenchmarkDataset for BenchmarkDatasets {
555555
}
556556
}
557557

558-
fn to_vortex_array(&self) -> VortexResult<Array> {
558+
fn to_vortex_array(&self) -> VortexResult<ArrayData> {
559559
self.write_as_parquet();
560560

561561
let arrays = self

bench-vortex/src/reader.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use vortex::file::{
3232
};
3333
use vortex::io::{ObjectStoreReadAt, TokioFile, VortexReadAt, VortexWrite};
3434
use vortex::sampling_compressor::{SamplingCompressor, ALL_ENCODINGS_CONTEXT};
35-
use vortex::{Array, IntoArray, IntoCanonical};
35+
use vortex::{ArrayData, IntoArrayData, IntoCanonical};
3636

3737
static DISPATCHER: LazyLock<Arc<IoDispatcher>> =
3838
LazyLock::new(|| Arc::new(IoDispatcher::new_tokio(1)));
@@ -46,7 +46,7 @@ pub struct VortexFooter {
4646
pub dtype_range: Range<u64>,
4747
}
4848

49-
pub async fn open_vortex(path: &Path) -> VortexResult<Array> {
49+
pub async fn open_vortex(path: &Path) -> VortexResult<ArrayData> {
5050
let file = TokioFile::open(path).unwrap();
5151

5252
VortexReadBuilder::new(
@@ -85,12 +85,12 @@ pub fn read_parquet_to_vortex<P: AsRef<Path>>(parquet_path: P) -> VortexResult<C
8585
let dtype = DType::from_arrow(reader.schema());
8686
let chunks = reader
8787
.map(|batch_result| batch_result.unwrap())
88-
.map(Array::try_from)
88+
.map(ArrayData::try_from)
8989
.collect::<VortexResult<Vec<_>>>()?;
9090
ChunkedArray::try_new(chunks, dtype)
9191
}
9292

93-
pub fn compress_parquet_to_vortex(parquet_path: &Path) -> VortexResult<Array> {
93+
pub fn compress_parquet_to_vortex(parquet_path: &Path) -> VortexResult<ArrayData> {
9494
let chunked = read_parquet_to_vortex(parquet_path)?;
9595
CompressionStrategy::compress(&SamplingCompressor::default(), &chunked.into_array())
9696
}
@@ -117,33 +117,33 @@ pub fn write_csv_as_parquet(csv_path: PathBuf, output_path: &Path) -> VortexResu
117117
async fn take_vortex<T: VortexReadAt + Unpin + 'static>(
118118
reader: T,
119119
indices: &[u64],
120-
) -> VortexResult<Array> {
120+
) -> VortexResult<ArrayData> {
121121
VortexReadBuilder::new(
122122
reader,
123123
LayoutDeserializer::new(
124124
ALL_ENCODINGS_CONTEXT.clone(),
125125
LayoutContext::default().into(),
126126
),
127127
)
128-
.with_indices(Array::from(indices.to_vec()))
128+
.with_indices(ArrayData::from(indices.to_vec()))
129129
.build()
130130
.await?
131131
.read_all()
132132
.await
133133
// For equivalence.... we decompress to make sure we're not cheating too much.
134134
.and_then(IntoCanonical::into_canonical)
135-
.map(Array::from)
135+
.map(ArrayData::from)
136136
}
137137

138138
pub async fn take_vortex_object_store(
139139
fs: Arc<dyn ObjectStore>,
140140
path: object_store::path::Path,
141141
indices: &[u64],
142-
) -> VortexResult<Array> {
142+
) -> VortexResult<ArrayData> {
143143
take_vortex(ObjectStoreReadAt::new(fs.clone(), path), indices).await
144144
}
145145

146-
pub async fn take_vortex_tokio(path: &Path, indices: &[u64]) -> VortexResult<Array> {
146+
pub async fn take_vortex_tokio(path: &Path, indices: &[u64]) -> VortexResult<ArrayData> {
147147
take_vortex(TokioFile::open(path)?, indices).await
148148
}
149149

0 commit comments

Comments
 (0)