Skip to content

qb: Array producing functions don't work? #896

@msullivan

Description

@msullivan
        q = default.GameSession.select(
            "*",
            players=True,
        ).filter(
            lambda g: std.array_agg(g.players.id)
            == std.array_agg(green.users.id)
        )

fails at runtime with

  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 300, in wrapper
    return attrval(*args, __operand__=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qbmodel/_abstract/_methods.py", line 140, in filter
    add_filter(cls, *exprs, __operand__=__operand__, **properties),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qbmodel/_abstract/_expressions.py", line 269, in add_filter
    all_exprs = [_qb.edgeql_qb_expr(expr, var=prefix) for expr in exprs]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_protocols.py", line 145, in edgeql_qb_expr
    x = x(var)
        ^^^^^^
  File "/home/sully/src/e/edgedb-python/tests/test_qb.py", line 371, in <lambda>
    lambda g: std.array_agg(g.players.id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 213, in <lambda>
    lambda self, other, op=op: self.__infix_op__(op, other),
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_qb/_generics.py", line 333, in __infix_op__
    type_class = this_operand.__gel_type_class__
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Array[models.orm.__shapes__.std.uuid]' has no attribute '__gel_type_class__'

And it fails to typecheck because __eq__ is not overloaded on Array in a way visible to the typechecker. (And the way not visible seems broken?)

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