Skip to content

Conversation

@sundy-li
Copy link
Member

@sundy-li sundy-li commented Sep 1, 2024

example

@udf(
    name="gcd_batch",
    input_types=["INT", "INT"],
    result_type="INT",
    batch_mode=True,
)
def gcd_batch(x: list[int], y: list[int]) -> list[int]:
    def gcd_single(x_i, y_i):
        if x_i == None or y_i == None:
            return None
        while y_i != 0:
            (x_i, y_i) = (y_i, x_i % y_i)
        return x_i
    return [gcd_single(x_i, y_i) for x_i, y_i in zip(x, y)]

fixes #9

@sundy-li sundy-li changed the title support batch mode feat: support batch mode Sep 1, 2024
@BohuTANG BohuTANG requested a review from everpcpc September 1, 2024 04:12
@everpcpc everpcpc merged commit 6c2454f into databendlabs:main Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eval_batch is not really batch, it's row by row

2 participants