Skip to content

UDF support in QL #558

Open
Open

Description

@andrus

See #567 for a logical prerequisite that makes this feature possible.

The last remaining disparity between Exp API and QL is the lack of user-defined functions in the latter. Let's create a syntax to pass UDFs as QL parameters that would to emulate mapVal(..) and mapBoolVal(..). Some examples...

  1. Anonymous functions passed as positional parameters. Easy to define on the spot, but lack types. ?f is a special parameter syntax that expects a function:
df.cols().select(
   "?f(a, b, c, d) > 5 and bool(?f(e, ?))",
   UdfN.of(this::op1),
   Udf2.of(this::op2),
   100);
  1. A context for named and typed functions. More effort to setup, but the functions are reusable and the expression syntax is clean:
// Suppose we can even stick one of these contexts in the shared 
// Environment to define global functions
ExpContext context = ExpContext.of()
        .intFunction("myOp", this::op1)
        .boolFunction("myPredicate", this::op2);

df.cols().select(
        context, 
        "myOp(a, b, c, d) > 5 and myPredicate(e, ?)", 
        100);

Activity

  1. added this to the 2.0.0-M6 milestone on Nov 8, 2025
  2. modified the milestones: 2.0.0-M6, 2.0.0-M7 on Jan 10, 2026
  3. modified the milestones: 2.0.0-M7, 2.0.0-M8 on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions