Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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