Skip to content

Commit

Permalink
Store min timestamp on the layer trait
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Sep 27, 2024
1 parent 37a64c6 commit 6addb2e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lonboard/experimental/traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import math
import warnings
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Tuple

import arro3.compute as ac
from arro3.core import (
Expand Down Expand Up @@ -189,7 +189,7 @@ def validate_timestamp_offsets(self, obj: BaseArrowLayer, value: ChunkedArray):
info="timestamp array's offsets to match geometry array's offsets.",
)

def validate(self, obj: BaseArrowLayer, value) -> ChunkedArray:
def validate(self, obj: BaseArrowLayer, value) -> Tuple[Scalar, ChunkedArray]:
if hasattr(value, "__arrow_c_array__"):
value = ChunkedArray([Array.from_arrow(value)])
elif hasattr(value, "__arrow_c_stream__"):
Expand All @@ -210,4 +210,6 @@ def validate(self, obj: BaseArrowLayer, value) -> ChunkedArray:
value = self.reduce_precision(obj, value)
value = value.rechunk(max_chunksize=obj._rows_per_chunk)
self.validate_timestamp_offsets(obj, value)
return value

min_timestamp = ac.min(list_flatten(value))
return min_timestamp, value

0 comments on commit 6addb2e

Please sign in to comment.