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

[Java] Method can return the value bigger than long MAX_VALUE #15305

Closed
asfimport opened this issue Mar 10, 2016 · 6 comments
Closed

[Java] Method can return the value bigger than long MAX_VALUE #15305

asfimport opened this issue Mar 10, 2016 · 6 comments

Comments

@asfimport
Copy link

Method org.apache.drill.exec.util.DecimalUtility.adjustScaleMultiply(long input, int factor) can return the value bigger than long max value.
For example by comparison two decimal18 values 9223372036854775807 and 0.001. To adjust first value scale this method should return 9223372036854775807 * 1000 - bigger than long max value.

Class DecimalUtility.java will be a part of org.apache.arrow after renaming described in [DRILL-4455 Depend on Apache Arrow for Vector and Memory| https://issues.apache.org/jira/browse/DRILL-4455]

Environment: Apache Drill, Apache Arrow
Reporter: Vitalii Diravka
Assignee: Ji Liu / @tianchen92

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-61. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Fangzhou:
Could you please clarify which method has the problem?

@asfimport
Copy link
Author

Vitalii Diravka:
[~lfz_carlos] This is adjustScaleMultiply(long input, int factor) method. I have already mentioned where it is in drill.
In apache arrow this is org/apache/arrow/vector/util/DecimalUtility.java class.

public static long adjustScaleMultiply(long input, int factor) {
      int index = Math.abs(factor);
      assert index >= 0 && index < scale_long_constants.length;
      if (factor >= 0) {
        return input * scale_long_constants[index];
      } else {
        return input / scale_long_constants[index];
      }
    }

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Is this still an issue?

@asfimport
Copy link
Author

Ji Liu / @tianchen92:
@wesm I checked the code and found that the problem still exists. BTW, Drill have removed these methods in DRILL-6421, I would like to provide a PR to remove these unused methods, what do you think?

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Sure, please go ahead

@asfimport
Copy link
Author

Ji Liu / @tianchen92:
@wesm Thanks very much for your reply, I have submitted a [PR|[https://github.com//pull/4266]], please take a look, thanks!

@asfimport asfimport added this to the 0.14.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants