Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alancai98 opened this issue Mar 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alancai98
Copy link
Member

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
@alancai98 alancai98 added the bug Something isn't working label Mar 21, 2024
@alancai98
Copy link
Member Author

A few possible resolutions

  • keep as it is
  • change CAST table related to some unsafe casts
  • remove the specific EQ__TYPE_TYPE__BOOL variants and just have EQ__ANY_ANY__BOOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant