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

Query language fails to call python methods properly with grouped columns #2577

Closed
chipkent opened this issue Jun 24, 2022 · 0 comments · Fixed by #3458
Closed

Query language fails to call python methods properly with grouped columns #2577

chipkent opened this issue Jun 24, 2022 · 0 comments · Fixed by #3458
Assignees
Labels
bug Something isn't working python query engine
Milestone

Comments

@chipkent
Copy link
Member

The query language is not properly calling python functions when columns are grouped. The example below illustrates the problem. Array values seem to be expanded and passed in as separate arguments, instead of being passed in as a single array argument.

from deephaven import time_table

t1 = time_table("00:00:01").update(["TimeBin = upperBin(Timestamp, '00:00:03')", "Person = random() > 0.5 ? `A` : random() > 0.5 ? `B` : `C`"])

t2 = t1 \
    .drop_columns("Timestamp") \
    .select_distinct(["TimeBin", "Person"]) \
    .sort(["TimeBin", "Person"]) \
    .group_by("TimeBin")

# single positional argument
def make_pairs_1(a):
    return 1

# take any inputs as an array
def make_pairs_2(*a):
    return 2

# works
x11 = t1.update("Pair=(int)make_pairs_1(Person)")
# works
x12 = t1.update("Pair=(int)make_pairs_2(Person)")
# fails
x21 = t2.update("Pair=(int)make_pairs_1(Person)")
# works
x22 = t2.update("Pair=(int)make_pairs_2(Person)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python query engine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants