-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathtesting_funs.py
More file actions
38 lines (29 loc) · 924 Bytes
/
testing_funs.py
File metadata and controls
38 lines (29 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# (C) 2024 GoodData Corporation
from typing import Optional
import pyarrow
from gooddata_flexconnect.function.function import FlexConnectFunction
from gooddata_flight_server import ArrowData, ServerContext
class Fun1(FlexConnectFunction):
Name = "fun1"
Schema = pyarrow.schema(fields=[pyarrow.field("col", pyarrow.int64())])
def call(
self,
parameters: dict,
columns: Optional[tuple[str, ...]],
headers: dict[str, list[str]],
) -> ArrowData:
pass
class Fun2(FlexConnectFunction):
Name = "fun2"
Schema = pyarrow.schema(fields=[pyarrow.field("col", pyarrow.string())])
OnLoadCalled = False
def call(
self,
parameters: dict,
columns: Optional[tuple[str, ...]],
headers: dict[str, list[str]],
) -> ArrowData:
pass
@staticmethod
def on_load(ctx: ServerContext):
Fun2.OnLoadCalled = True