Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Changelog

## 5.31.1
### What's Changed
* Sort tables by time by default for any `pyarrow` tables. by @justinGilmer in
* Fix deprecation warnings for pip installations. by @jleifnf in

## 5.31.0

## 5.30.2
### What's Changed
* Update readthedocs to new yaml for testing. by @justinGilmer in https://github.com/PingThingsIO/btrdb-python/pull/40
Expand Down
20 changes: 3 additions & 17 deletions btrdb/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ def arrow_aligned_windows(
start: int,
end: int,
pointwidth: int,
sort_time: bool = False,
version: int = 0,
auto_retry=False,
retries=5,
Expand Down Expand Up @@ -1084,8 +1083,6 @@ def arrow_aligned_windows(
:func:`btrdb.utils.timez.to_nanoseconds` for valid input types)
pointwidth : int, required
Specify the number of ns between data points (2**pointwidth)
sort_time : bool, default: False
Should the table be sorted on the 'time' column?
version : int, default: 0
Version of the stream to query
auto_retry: bool, default: False
Expand Down Expand Up @@ -1128,10 +1125,7 @@ def arrow_aligned_windows(
)
if len(tables) > 0:
tabs, ver = zip(*tables)
if sort_time:
return pa.concat_tables(tabs).sort_by("time")
else:
return pa.concat_tables(tabs)
return pa.concat_tables(tabs).sort_by("time")
else:
schema = pa.schema(
[
Expand Down Expand Up @@ -1225,7 +1219,6 @@ def arrow_windows(
start: int,
end: int,
width: int,
sort_time: bool = False,
version: int = 0,
auto_retry=False,
retries=5,
Expand All @@ -1244,8 +1237,6 @@ def arrow_windows(
:func:`btrdb.utils.timez.to_nanoseconds` for valid input types)
width : int, required
The number of nanoseconds in each window.
sort_time : bool, default: False
Should the table be sorted on the 'time' column.
version : int, default=0, optional
The version of the stream to query.
auto_retry: bool, default: False
Expand Down Expand Up @@ -1296,10 +1287,7 @@ def arrow_windows(
)
if len(tables) > 0:
tabs, ver = zip(*tables)
if sort_time:
return pa.concat_tables(tabs).sort_by("time")
else:
return pa.concat_tables(tabs)
return pa.concat_tables(tabs).sort_by("time")
else:
schema = pa.schema(
[
Expand Down Expand Up @@ -2160,7 +2148,6 @@ def arrow_values(
data = tablex
else:
data = tablex
data = data.sort_by("time")

elif self.width is not None and self.depth is not None:
# create list of stream.windows data (the windows method should
Expand Down Expand Up @@ -2191,7 +2178,6 @@ def arrow_values(
data = tablex
else:
data = tablex
data = data.sort_by("time")
else:
sampling_freq = params.pop("sampling_frequency", 0)
period_ns = 0
Expand All @@ -2214,7 +2200,7 @@ def arrow_values(
data = pa.Table.from_arrays(
[pa.array([]) for i in range(1 + len(self._streams))], schema=schema
)
return data
return data.sort_by("time")

def __repr__(self):
token = "stream" if len(self) == 1 else "streams"
Expand Down