Skip to content

Commit e46686f

Browse files
committed
merge main
2 parents 2189751 + df529d5 commit e46686f

8 files changed

Lines changed: 27 additions & 696 deletions

File tree

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ site/*
3030
*.png
3131
*.jpg
3232
*.parquet
33-
*.valor
33+
<<<<<<< HEAD
34+
*.valor
35+
=======
36+
37+
.valor/*
38+
>>>>>>> origin/main

src/valor_lite/cache/compute.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def _merge(
1616
batch_size: int,
1717
sorting: list[tuple[str, str]],
1818
columns: list[str] | None = None,
19-
table_sort_override: Callable[[pa.table], pa.table] | None = None,
19+
table_sort_override: Callable[[pa.Table], pa.Table] | None = None,
2020
):
2121
"""Merge locally sorted cache fragments."""
2222
for tbl in source.iterate_tables(columns=columns):
@@ -75,7 +75,7 @@ def create_sort_key(
7575
create_sort_key(batches, batch_idx, 0),
7676
)
7777

78-
sink.flush()
78+
sink.flush()
7979

8080

8181
def sort(
@@ -84,7 +84,7 @@ def sort(
8484
batch_size: int,
8585
sorting: list[tuple[str, str]],
8686
columns: list[str] | None = None,
87-
table_sort_override: Callable[[pa.table], pa.table] | None = None,
87+
table_sort_override: Callable[[pa.Table], pa.Table] | None = None,
8888
):
8989
"""
9090
Sort data into new cache.
@@ -100,9 +100,9 @@ def sort(
100100
sorting : list[tuple[str, str]]
101101
Sorting arguments in PyArrow format (e.g. [('a', 'ascending'), ('b', 'descending')]).
102102
Note that only numeric fields are supported.
103-
columns : list[tuple[str, str]], optional
103+
columns : list[str], optional
104104
Option to only read a subset of columns.
105-
table_sort_override : Callable[[pa.table], pa.table], optional
105+
table_sort_override : Callable[[pa.Table], pa.Table], optional
106106
Option to override sort function for singular cache fragments.
107107
"""
108108

src/valor_lite/cache/ephemeral.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,30 @@ def iterate_tables_with_arrays(
106106
Iterator[tuple[pa.Table, np.ndarray]]
107107
108108
"""
109+
_columns = set(columns) if columns else set()
110+
_numeric_columns = set(numeric_columns) if numeric_columns else set()
111+
columns = list(_columns.union(_numeric_columns))
109112
for tbl in self.iterate_tables(
110113
columns=columns,
111114
filter=filter,
112115
):
113-
columns = numeric_columns if numeric_columns else tbl.columns
116+
table_columns = numeric_columns if numeric_columns else tbl.columns
114117
yield tbl, np.column_stack(
115-
[tbl[col].to_numpy() for col in columns]
118+
[tbl[col].to_numpy() for col in table_columns]
116119
)
117120

118121
def iterate_fragments(
119122
self, batch_size: int
120123
) -> Iterator[Iterator[pa.RecordBatch]]:
121124
"""
122-
Iterate over fragment batch iterators within the file-based cache.
125+
Yield a table batch iterator.
126+
127+
This is intended to emulate file-based access patterns.
123128
124129
Parameters
125130
----------
126131
batch_size : int
127-
Maximum number of rows allowed to be read into memory per cache file.
132+
Maximum number of rows allowed to be read per batch.
128133
129134
Yields
130135
------

src/valor_lite/cache/persistent.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,16 @@ def iterate_tables_with_arrays(
231231
Iterator[tuple[pa.Table, np.ndarray]]
232232
233233
"""
234+
_columns = set(columns) if columns else set()
235+
_numeric_columns = set(numeric_columns) if numeric_columns else set()
236+
columns = list(_columns.union(_numeric_columns))
234237
for tbl in self.iterate_tables(
235238
columns=columns,
236239
filter=filter,
237240
):
238-
columns = numeric_columns if numeric_columns else tbl.columns
241+
table_columns = numeric_columns if numeric_columns else tbl.columns
239242
yield tbl, np.column_stack(
240-
[tbl[col].to_numpy() for col in columns]
243+
[tbl[col].to_numpy() for col in table_columns]
241244
)
242245

243246
def iterate_fragments(

src/valor_lite/common/datatype.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/valor_lite/common/ephemeral.py

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)