Skip to content

Commit 692e399

Browse files
committed
UNPICK uv install geodatafusion
1 parent 8d8f219 commit 692e399

File tree

3 files changed

+35
-41
lines changed

3 files changed

+35
-41
lines changed
Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,5 @@
1-
import pyarrow as pa
2-
from datafusion import udaf, SessionContext
3-
from datafusion.user_defined import Accumulator # base class for aggregators
1+
from datafusion import udaf
2+
from geodatafusion import native
43

5-
# Define a simple test accumulator for demonstration:
6-
class TestAccumulator(Accumulator):
7-
def __init__(self) -> None:
8-
self.total = 0
9-
10-
def state(self) -> list[pa.Scalar]:
11-
return [pa.scalar(self.total)]
12-
13-
def update(self, *values: pa.Array) -> None:
14-
# Sum up integer values from the first argument
15-
self.total += sum(value.as_py() for value in values[0])
16-
17-
def merge(self, states: list[pa.Array]) -> None:
18-
# Assumes the state is a list with one scalar integer per actor
19-
self.total += sum(state[0].as_py() for state in states)
20-
21-
def evaluate(self) -> pa.Scalar:
22-
return pa.scalar(self.total)
23-
24-
# Create the test UDAF using TestAccumulator.
25-
# Note: the overload taking (accum, input_types, return_type, state_type, volatility, name)
26-
test_udaf = udaf(
27-
TestAccumulator, # accumulator function or type producing an Accumulator object
28-
[pa.int64()], # input types (list of one int64)
29-
pa.int64(), # return type
30-
[pa.int64()], # state type (list of one int64)
31-
"immutable", # volatility indicator
32-
name="test_udaf"
33-
)
34-
35-
# Register UDAF into a session context (if needed)
36-
ctx = SessionContext()
37-
ctx.register_udaf(test_udaf)
38-
39-
# The code should type check without error:
40-
print("Type checking passed for test_udaf!")
4+
# replicate the original call
5+
udaf(native.Extent())

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ classifiers = [
4343
"Programming Language :: Python",
4444
"Programming Language :: Rust",
4545
]
46-
dependencies = ["pyarrow>=11.0.0", "typing-extensions;python_version<'3.13'"]
46+
dependencies = [
47+
"geodatafusion>=0.1.1",
48+
"pyarrow>=11.0.0",
49+
"typing-extensions;python_version<'3.13'",
50+
]
4751
dynamic = ["version"]
4852

4953
[project.urls]

uv.lock

Lines changed: 26 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)