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

Get wrong value when put a big integer number #1999

Open
wangsq opened this issue Oct 11, 2024 · 4 comments
Open

Get wrong value when put a big integer number #1999

wangsq opened this issue Oct 11, 2024 · 4 comments
Labels

Comments

@wangsq
Copy link

wangsq commented Oct 11, 2024

Describe your problem

When I put a big int number into vineyard, but get just 1 when the value is great than 2**63.


1. Get Right Value

value = 2**63-1
oid = client.put(value)

result = client.get(oid)
print(f'{value=}, {result=}, {value == int(result)}')

output:

value=9223372036854775807, result=9223372036854775807, True

2. Get Wrong Value When Big Integer

value = 2**63
oid = client.put(value)

result = client.get(oid)
print(f'{value=}, {result=}, {value == int(result)}')

output
value=9223372036854775808, result=1, False

3. Use float cast , get right value

value = 2**126
oid = client.put(float(value))

result = client.get(oid)
print(f'{value=}, {int(result)=}, {value == int(result)}')

output
value=85070591730234615865843651857942052864, int(result)=85070591730234615865843651857942052864, True

4. Use float cast , get wrong value, big float

value = 2**126+1
oid = client.put(float(value))

result = client.get(oid)
print(f'{value=}, {int(result)=}, {value == int(result)}')

output:
value=85070591730234615865843651857942052865, int(result)=85070591730234615865843651857942052864, False


If is is a bug report, to help us reproducing this bug, please provide information below:

  1. Your Operation System version (uname -a): Linux 6.8.0-45-generic Fixes bugs in launcher when multiple host and multiple workers involved. #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug fd 11 Dumping 301618 Realtime Data. │ 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

  2. The version of vineyard you use (vineyard.__version__): '0.24.2'

  3. Versions of crucial packages, such as gcc, numpy, pandas, etc.:

  4. Full stack of the error (if there are a crash):

  5. Minimized code to reproduce the error:


If it is a feature request, please provides a clear and concise description of what you want to happen:

What is the problem:

The behaviour that you expect to work:

Additional context

Add any other context about the problem here.

@dashanji
Copy link
Member

@wangsq Thanks for reporting this issue, we'll check it as soon as possible.

@github-actions github-actions bot added the stale label Nov 12, 2024
Copy link
Contributor

/cc @sighingnow, this issus/pr has had no activity for a long time, please help to review the status and assign people to work on it.

@dashanji
Copy link
Member

dashanji commented Nov 16, 2024

@wangsq, this issue may be caused by data type conversion between Python and C++. In Python, when pass the 2**63 to a template function in C++, it may be incorrectly interpreted as a Boolean value by the compiler and converted to 1 as you seen.

Could you please tell me what scenario you need to put a large interger number? Is it possible to use the string to workaround?

@wangsq
Copy link
Author

wangsq commented Dec 13, 2024

@wangsq, this issue may be caused by data type conversion between Python and C++. In Python, when pass the 2**63 to a template function in C++, it may be incorrectly interpreted as a Boolean value by the compiler and converted to 1 as you seen.

Could you please tell me what scenario you need to put a large interger number? Is it possible to use the string to workaround?

I want to store Memory Address as integer in v6d. It is always like a big int.

Now I put the value by casting to numpy unsigned integer . It works.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants