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

HPCC4J-562 Odd unsigned decimals incorrect scale #666

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

jpmcmu
Copy link
Contributor

@jpmcmu jpmcmu commented Dec 13, 2023

  • Corrected BinaryRecordReader unsigned decimal parse code
  • Updated ECL test datasets to include odd precision decimal values

Signed-off-by: James McMullan [email protected]

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change is a breaking change (fix or feature that will cause existing behavior to change).

Checklist:

  • I have created a corresponding JIRA ticket for this submission
  • My code follows the code style of this project.
    • I have applied the Eclipse code-format template provided.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the HPCC Systems CONTRIBUTORS document (https://github.com/hpcc-systems/HPCC-Platform/wiki/Guide-for-contributors).
  • The change has been fully tested:
    • This change does not cause any existing JUnits to fail.
    • I have include JUnit coverage to test this change
    • I have performed system test and covered possible regressions and side effects.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • This change fixes the problem, not just the symptom

Testing:

@jpmcmu
Copy link
Contributor Author

jpmcmu commented Dec 13, 2023

@rpastrana please review. @jchambers-ln @drealeed FYI

Copy link
Member

@rpastrana rpastrana left a comment

Choose a reason for hiding this comment

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

@jpmcmu a couple of comments.

self.udec16 := (REAL)(random() % unique_values);
self.udec15 := (REAL)(random() % unique_values);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a corresponding test to verify these odd len decimals are correctly read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rpastrana Yes, tests in DFSReadWriteTest read those generated datasets, write them back, and then compare the datasets against the generated datasets for correctness.

@@ -830,7 +830,11 @@ private BigDecimal getUnsignedDecimal(int numDigits, int precision, int dataLen)
BigDecimal ret = new BigDecimal(0);

int idx = 0;
int curDigit = numDigits - 1;
int curDigit = numDigits;
if ((numDigits % 2) == 0)
Copy link
Member

Choose a reason for hiding this comment

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

It's not entirely obvious to me why this logic is needed, perhaps an inline comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, added a comment and squashed

- Corrected BinaryRecordReader unsigned decimal parse code
- Updated ECL test datasets to include odd precision decimal values

Signed-off-by: James McMullan [email protected]
Copy link
Member

@rpastrana rpastrana left a comment

Choose a reason for hiding this comment

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

@rpastrana rpastrana merged commit b3b7647 into hpcc-systems:candidate-9.4.x Dec 13, 2023
4 checks passed
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.

2 participants