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

SQL remainder operation [IMDG-147] #17997

Merged
merged 5 commits into from Jan 19, 2021
Merged

SQL remainder operation [IMDG-147] #17997

merged 5 commits into from Jan 19, 2021

Conversation

devozerov
Copy link
Contributor

This PR introduces the remainder (mod), operator:

  1. The operator coerces both operands to the type with the higher precedence without extending the bit width (unlike division) because it seems that there could be no overflow.
  2. The return type is the same as the operand type. Alternatively, we may have reduced it to the second operand (e.g. BIGINT % SMALLINT => SMALLINT), but this would complicate the implementation of the operator because we would have many more combinations. We may leave it as a future optimization, but meanwhile, I prefer to keep things simple.
  3. Inexact types (float, double) are not supported, like in major databases (e.g., Postgres, SQL Server).

Closes #17334

@devozerov devozerov added Team: Core Source: Internal PR or issue was opened by an employee Team: SQL labels Dec 22, 2020
@devozerov devozerov added this to the 4.2 milestone Dec 22, 2020
@devozerov devozerov self-assigned this Dec 22, 2020
@taburet taburet removed their request for review December 23, 2020 04:00
@hazelcast hazelcast deleted a comment Dec 23, 2020
Copy link
Contributor

@petrpleshachkov petrpleshachkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@devozerov devozerov merged commit 6fa873c into hazelcast:master Jan 19, 2021
@devozerov devozerov deleted the sql-expr-remainder branch January 19, 2021 09:08
@devozerov devozerov changed the title SQL remainder operation SQL remainder operation [IMDG-147] Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Team: SQL Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support remainder operator
4 participants