Skip to content

Maybe_ generate wrong (non intuitive) sql query #524

Open
@sashasashasasha151

Description

@sashasashasasha151

I have left and right table, where right table contains nullable fields
I join them with leftJoin_ and try to create filter_ which has such condition:

maybe_ nothing_ nullableFieldFromRightTable rt /=. just_ (val_ 1)

So, if rt is null just return nothing and if rt is not null return nullableFieldFromRightTable which will return nothing or just value
I am using it as beam doen't support to check nested maybes
Then I just check if it is different from just 1
This code compiles but I get invalid result, so, here is why:

CASE
  WHEN ((((("t1"."someField1") IS NOT NULL) AND (("t1"."someField2") IS NOT NULL)) AND
    (("t1"."nullableFieldFromRightTable") IS NOT NULL)) AND <all_other_fields_from_table> IS NOT NULL) 
    THEN "t1"."nullableFieldFromRightTable"
  ELSE null END) IS DISTINCT FROM 1)

Beam generates strange query which doesn't the meaning of the beam query

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions