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

Int value range is incorrect #826

Closed
moneytoyang opened this issue Aug 21, 2019 · 4 comments · Fixed by #1181
Closed

Int value range is incorrect #826

moneytoyang opened this issue Aug 21, 2019 · 4 comments · Fixed by #1181
Assignees
Labels
priority/med-pri Priority: medium

Comments

@moneytoyang
Copy link
Contributor

moneytoyang commented Aug 21, 2019

数类
Nebula支持两种基础数据类型 -- int64 & double

int64的范围是[-9223372036854775808, 9223372036854775807]。double没有上限和下限。

注意:在基于int64的计算中不存在溢出。

case:

(user@127.0.0.1) [myspace]> create tag  player(name string, age int);
Execution succeeded (Time spent: 3024/4232 us)


(user@127.0.0.1) [myspace]> show tags;
==========
| Name   |
==========
| player |
----------
Got 1 rows (Time spent: 2356/3419 us)



(user@127.0.0.1) [myspace]> desc tag player;
==================
| Field | Type   |
==================
| name  | string |
------------------
| age   | int    |
------------------
Got 2 rows (Time spent: 1188/2033 us)


(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", 9223372036854775808);
[ERROR (-7)]: syntax error near `9223372036854775808'
(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", 9223372036854775809);
[ERROR (-7)]: syntax error near `9223372036854775809'
(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", 92233720368547758010);
[ERROR (-7)]: syntax error near `92233720368547758010'
(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", 922337203685477580100);
[ERROR (-7)]: syntax error near `922337203685477580100'

(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", 9223372036854775807);
Execution succeeded (Time spent: 1708/2260 us)


(user@127.0.0.1) [myspace]> fetch prop on player 1001;
======================================
| player.name | player.age           |
======================================
| yangzi      | 9223372036854775807 |
--------------------------------------
Got 1 rows (Time spent: 2341/3002 us)


##########################################################
(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1001:("yangzi", -9223372036854775808);
[ERROR (-7)]: syntax error near `9223372036854775808'

(user@127.0.0.1) [myspace]> insert vertex player(name, age) values 1002:("yangzi", -9223372036854775807);
Execution succeeded (Time spent: 1400/1974 us)

(user@127.0.0.1) [myspace]> fetch prop on player 1002;
=====================================
| player.name | player.age          |
=====================================
| yangzi      | -9223372036854775807 |
-------------------------------------
Got 1 rows (Time spent: 2186/3153 us)

-9223372036854775808 value should be able to insert database int column.

@moneytoyang
Copy link
Contributor Author

@moneytoyang
Copy link
Contributor Author

I will try to fix this issue myself.

@moneytoyang
Copy link
Contributor Author

Insert edge has the same question.

@moneytoyang moneytoyang changed the title Wrong result Int value range is incorrect Aug 21, 2019
@whitewum
Copy link
Contributor

Great!

@whitewum whitewum added the priority/med-pri Priority: medium label Aug 23, 2019
moneytoyang added a commit to moneytoyang/nebula that referenced this issue Aug 28, 2019
dutor added a commit that referenced this issue Jan 7, 2020
* Fix arithmetic overflow

* fix #826 Int value range is incorrect

* rebase upstream

* rebase upstream

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
tong-hao pushed a commit to tong-hao/nebula that referenced this issue Jun 1, 2021
* Fix arithmetic overflow

* fix vesoft-inc#826 Int value range is incorrect

* rebase upstream

* rebase upstream

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/med-pri Priority: medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants