-
Notifications
You must be signed in to change notification settings - Fork 7
value_numeric support for scientific notation #381
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the handling of numeric values by extending support to scientific notation in the value_numeric column.
- Updated the regex pattern for value_numeric to include scientific notation syntax.
- Adjusted the SQL column definition formatting.
inline comment Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug by enabling support for numeric values expressed in scientific notation in the value_numeric column.
- Updates the regex pattern to include scientific notation (e.g., 1e10, -2.5E-3)
- Adds a clarifying inline comment and adjusts the SQL syntax ending with a semicolon
Comments suppressed due to low confidence (1)
src/xian/services/bds/sql.py:49
- The updated regex correctly introduces support for scientific notation; please verify that you have adequate tests covering edge cases (e.g., negative numbers, various exponent formats) to ensure reliable behavior.
WHEN value::text ~ '^"*-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?"*$'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug by updating the regular expressions used to generate value_numeric, ensuring that numerical values in scientific notation are now correctly recognized.
- Updated regex patterns in both create_state and create_state_changes to support scientific notation.
- Added an inline comment to clarify the regex logic for scientific notation.
Comments suppressed due to low confidence (2)
src/xian/services/bds/sql.py:30
- It would be beneficial to add tests covering various numeric formats including scientific notation, decimals, and negative values to ensure the regex behaves as expected.
THEN (trim(both '"' from value::text))::NUMERIC
src/xian/services/bds/sql.py:49
- The updated regex now supports scientific notation, but please verify it correctly handles edge cases such as numbers without a fractional part or exponent properly.
WHEN value::text ~ '^"*-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?"*$'
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the numeric value conversion by enhancing the regular expression used for value_numeric to support scientific notation. Key changes include updating the regex pattern in two functions and adding inline comments documenting supported numeric formats.
Comments suppressed due to low confidence (2)
src/xian/services/bds/sql.py:51
- Consider adding test cases to validate the new scientific notation support for various valid and invalid numeric inputs, ensuring all edge cases are covered.
WHEN value::text ~ '^"*-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?"*$'
src/xian/services/bds/sql.py:51
- Ensure the updated regex pattern accurately handles all expected scientific notation formats, including edge cases like inputs without a decimal point or with negative exponents.
WHEN value::text ~ '^"*-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?"*$'
Description
value_numeric support for scientific notation
Type of change
Checklist