Files
greptimedb/tests/cases/standalone/aggregate/sum.result
LFC af935671b2 feat: support "use" in GRPC requests (#922)
* feat: support "use catalog and schema"(behave like the "use" in MySQL) in GRPC requests

* fix: rebase develop
2023-02-02 20:02:56 +08:00

86 lines
1.4 KiB
Plaintext

USE public;
++
++
SELECT SUM(number) FROM numbers;
+---------------------+
| SUM(numbers.number) |
+---------------------+
| 4950 |
+---------------------+
SELECT SUM(1) FROM numbers;
+---------------+
| SUM(Int64(1)) |
+---------------+
| 100 |
+---------------+
SELECT SUM(-1) FROM numbers;
+----------------+
| SUM(Int64(-1)) |
+----------------+
| -100 |
+----------------+
SELECT SUM(-1) FROM numbers WHERE number=-1;
+----------------+
| SUM(Int64(-1)) |
+----------------+
| |
+----------------+
SELECT SUM(-1) FROM numbers WHERE number>10000 limit 1000;
+----------------+
| SUM(Int64(-1)) |
+----------------+
| |
+----------------+
CREATE TABLE bigints(b BIGINT TIME INDEX);
Affected Rows: 0
INSERT INTO bigints values (4611686018427387904), (4611686018427388904), (1);
Affected Rows: 3
SELECT SUM(b) FROM bigints;
+----------------------+
| SUM(bigints.b) |
+----------------------+
| -9223372036854774807 |
+----------------------+
CREATE TABLE doubles(n DOUBLE, ts BIGINT TIME INDEX);
Affected Rows: 0
INSERT INTO doubles (n, ts) VALUES (9007199254740992, 1), (1, 2), (1, 3), (0, 4);
Affected Rows: 4
SELECT sum(n) from doubles;
+------------------+
| SUM(doubles.n) |
+------------------+
| 9007199254740992 |
+------------------+
DROP TABLE bigints;
Affected Rows: 1
DROP TABLE doubles;
Affected Rows: 1