Skip to content

Fix sqlancer#1209: UNARY_PLUS operator now converts values to DOUBLE PRECISION #1220

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guptapratykshh
Copy link

Description

This PR addresses an issue where the UNARY_PLUS operator (+) wasn't properly handling type promotion. In SQL (including Materialize/PostgreSQL), applying the unary + operator on a numeric value should promote it to DOUBLE PRECISION. The previous implementation simply returned the input value without performing any conversion, which could lead to mismatches in expected vs. actual results during testing.

Changes

Changed UNARY_PLUS operator's return type from INT to FLOAT (double precision). Implemented proper conversion of values to double precision. Added handling for different input types (int, boolean, string, float). Added missing asDouble() method to FloatConstant class. Added comprehensive test cases to verify the proper behavior

Testing

Added a tests file TestMaterializeUnaryPlus.java to verify the changes made.

Closes #1209

@guptapratykshh
Copy link
Author

@robins please look into this PR I have raised a new separate PR for that issue. #1210 (comment)

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

Successfully merging this pull request may close these issues.

Fix : UNARY_PLUS operator should convert value to DOUBLE in expected value generation
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy