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: implement AggCountWhere to support generic counting using Filter #369

Open
deephaven-internal opened this issue Dec 19, 2024 · 0 comments

Comments

@deephaven-internal
Copy link

This issue was auto-generated

PR: deephaven/deephaven-core#6497
Author: lbooker42

Original PR Body

Groovy Examples

Table countTable = table.aggBy(List.of(
        AggCountWhere("filter1", "intCol >= 50"),
        AggCountWhere("filter2", "intCol >= 50", "intCol != 80"),
        AggCountWhere("filter3", Filter.or(Filter.from("intCol >= 50", "intCol == 3"))),
        AggCountWhere("filter4", "true"),
        AggCountWhere("filter5", "false"),
        AggCountWhere("filter6", "intCol % 2 == 0"),
        AggCountWhere("filter7",
                Filter.and(Filter.or(Filter.from("false", "intCol % 3 == 0")),
                        Filter.or(Filter.from("false", "intCol % 2 == 0")))),
        AggCountWhere("filter8", "intCol % 2 == 0", "intCol % 3 == 0"),
        AggCountWhere("filter9",
                Filter.and(Filter.and(Filter.from("intCol > 0")),
                        Filter.and(Filter.from("intCol <= 10", "intCol >= 5")))),
        // Multiple input columns
        AggCountWhere("filter10", "intCol >= 5", "doubleCol <= 10.0"),
        AggCountWhere("filter11", "intCol >= 5 && intColNulls != 3 && doubleCol <= 10.0"),
        // DynamicWhereFilter
        AggCountWhere("filter12", new DynamicWhereFilter(setTable, true, MatchPairFactory.getExpressions("intCol")))),
        "Sym").sort("Sym");

Python Examples

from deephaven import empty_table
from deephaven.agg import count_where

table_size = 120000000
table = empty_table(table_size).update(["int1M=randomInt(0,1000000)", "int640=randomInt(0,640)", "int250=randomInt(0,250)"]).select()

# zero-key
t_count = table.agg_by(aggs=count_where(col="count", filters=["int1M < 500000", "int1M > 499000"]))

# bucketed
t_count = table.agg_by(aggs=count_where(col="count", filters=["int1M < 500000", "int1M > 499000"]), by="int250")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant