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

Deprecate int64 as return type of array_length and cardinality #10285

Closed
Tracked by #7732
xiangjinwu opened this issue Jun 12, 2023 · 1 comment
Closed
Tracked by #7732

Deprecate int64 as return type of array_length and cardinality #10285

xiangjinwu opened this issue Jun 12, 2023 · 1 comment

Comments

@xiangjinwu
Copy link
Contributor

The 2 functions return integer (int32) in PostgreSQL, but when they were first introduced in RisingWave, the return type was mistakenly implemented as bigint (int64).

This has been fixed by #10267 and new queries will generate plans with correct type. But we also allow old plans with int64 to execute right now.

We have several options:

  • (current) Both cardinality(list) -> int32 and cardinality(list) -> int64 are considered valid function overloads. The frontend uses infer_type_for_special to select the int32 version. Note that most array functions require infer_type_for_special anyways except for array_to_string/array-length (singly-typed)/cardinality (singly-typed).
  • Reject plans containing cardinality(list) -> int64 after we are confident it is not being used, possibly after we have a tool for users to transform an old-verson query plan to a new-version query plan.
  • Move the special handling code to when the executor build exprs. When it sees cardinality(list) -> int64 just build cast(cardinality(list) -> int32) -> int64. Note this cannot use the build_function macro which still inserts cardinality(list) -> int64 as a valid signature.
@xiangjinwu
Copy link
Contributor Author

maintenance cost is low with #11189, considering it done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant