Skip to content

query2 parser mis-splits arguments after a nested call like f(g("x"), "k", [...]) #164

Description

@ErikBjare

Found by a Python/Rust query parity suite (ActivityWatch/activitywatch, PR to follow). aw-core 33c8528.

The query2 parser mis-splits the arguments of a call whose first argument is a nested call containing a string, when more arguments follow. aw-server-rust parses the same queries fine.

Minimal repro

Bucket a with one event {"app": "Code"}:

RETURN = filter_keyvals(query_bucket("a"), "app", ["Code"]);
  • aw-server (Python): QueryFunctionException: Variable '['Code']' passed to function call is of invalid type. Expected <class 'str'> but was <class 'list'>
  • aw-server-rust: the event

Variants:

  • RETURN = merge_events_by_keys(query_bucket("a"), ["app", "title"]); gives QueryParseException: Syntax error: ]
  • a = query_bucket("a"); RETURN = filter_keyvals(a, "app", ["Code"]); works on both

aw-client and aw-webui assign intermediate variables, so their canonical queries are not affected, but hand-written queries (query explorer, custom visualizations) are.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions