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

Inconsistent type inference for date add/subtract interval operations #576

Open
LeonidChistov opened this issue Nov 14, 2023 Discussed in #574 · 0 comments
Open

Inconsistent type inference for date add/subtract interval operations #576

LeonidChistov opened this issue Nov 14, 2023 Discussed in #574 · 0 comments

Comments

@LeonidChistov
Copy link
Contributor

Discussed in #574

Following operations are defined in Substrait prototypes:

add(date, interval_year): -> timestamp
add(date, interval_day): -> timestamp
subtract(date, interval_year): -> date
subtract(date, interval_day): -> date

It looks like add and subtract behavior need to be consistent with regards to result type.

However, different databases/frameworks have different type inference for these operations:

  • Postrgres returns timestamp in all four cases
  • Calcite infers return type as date in all four cases

Probably it is not so important which type inference approach will be used by Substrait, because type casts from/to timestamp for operands/result can be used to adjust to specific DB semantics.

But there is no reason to let add and subtract have different type inference.

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

No branches or pull requests

1 participant