Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support batch mode #10

Merged
merged 4 commits into from
Sep 1, 2024
Merged

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
@everpcpc everpcpc merged commit 6c2454f into databendlabs:main Sep 1, 2024
3 checks passed
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