BigInt Data Type in Cassandra Query Language ( CQL)
BigInt in Cassandra Query Language ( CQL) takes 8 bytes storage to save the value. The range for BigInt is -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)Let's create a table with BigInt data type by using Cassandra Query Language ( CQL).
CQLSH:techbrotherstutorials>CREATE TABLE tbs
(
id INT PRIMARY KEY,
bigintvalue BIGINT
) ;
Let's insert some big values and test, I am going to insert couple of values in the range and couple of values out of range and see what message we get from Cassandra when run our statement.(
id INT PRIMARY KEY,
bigintvalue BIGINT
) ;
CQLSH:techbrotherstutorials> INSERT INTO tbs
(id,
bigintvalue)
VALUES (1,
-10000000);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (2,
200000);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (3,
-9223372036854775999);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (4,
9223372036854775999);
(id,
bigintvalue)
VALUES (1,
-10000000);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (2,
200000);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (3,
-9223372036854775999);
INSERT INTO tbs
(id,
bigintvalue)
VALUES (4,
9223372036854775999);
Noticed that first two values -10000000 and 200000 are in range. Last two values -9223372036854775999 and 9223372036854775999 are out of range. When I tried to insert, I got below error.
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to make long from '-9223372036854775999'"
Let's run Select query on table to check the data.
CQLSH:techbrotherstutorials>SELECT *
FROM tbs;
FROM tbs;
Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeletekinh nghiệm mua vé máy bay đi Mỹ giá rẻ
máy bay hà nội sài gòn
đặt vé máy bay cần thơ đi hà nội
vé máy bay đi Huế khứ hồi
vé máy bay tphcm quy nhơn
dịch vụ đưa đón sân bay
mua combo vinpearl phú quốc