Skip to content

Confirm plan typer behavior for equality between a type with a missable type #1398

Open
@alancai98

Description

Currently the PlanTyper will determine that calling = with a type and union(type, missing) will be a dynamic function call of EQ__TYPE_TYPE__BOOL and EQ__ANY_ANY__BOOL.

This can be seen by the below case:

-- below creates a dynamic call
CAST(1 AS INT4) = CAST(`1e0` as INT4)

, which outputs a dynamic rex op in the output plan.

⚬ PartiQLPlan[tag=Plan-1b087f8c]
   └──Query[tag=Plan-c60300c1]
      └──Rex[type=union(bool, null), tag=Plan-f83abf85]
         └──Dynamic[tag=Plan-f1007872]
            ├──Rex[type=int4, tag=Plan-f80ac24c]
            │  └──Static[tag=Plan-1abf6ded]
            │     ├──Fn[signature=CAST_INT32__INT32__INT32, tag=Plan-70959201]
            │     └──Rex[type=int4, tag=Plan-938c10e8]
            │        └──Lit[value=Int32ValueImpl(value=1, annotations=[]), tag=Plan-50664d78]
            ├──Rex[type=union(int4, missing), tag=Plan-5cd108a4]
            │  └──Static[tag=Plan-b6e6c73f]
            │     ├──Fn[signature=CAST_INT32__FLOAT64__INT32, tag=Plan-b28ae936]
            │     └──Rex[type=float, tag=Plan-9a8f3175]
            │        └──Lit[value=Float64ValueImpl(value=1.0, annotations=[]), tag=Plan-f3b0eb1e]
            ├──Candidate[tag=Plan-cf153ca8]
            │  └──Fn[signature=EQ__INT32_INT32__BOOL, tag=Plan-d7b0c1e]
            └──Candidate[tag=Plan-e40c23c3]
               └──Fn[signature=EQ__ANY_ANY__BOOL, tag=Plan-1d699bf6]

Additional Context

  • Java version: 11
  • PartiQL version: 0.14.5-SNAPSHOT

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions