From 240ea3dcb052f757290b53d1ccf52507cd0f6c3c Mon Sep 17 00:00:00 2001 From: prabatuty Date: Tue, 29 Jul 2008 07:29:21 +0000 Subject: [PATCH] *** empty log message *** --- test/tools/csql/agg1.sql | 44 +++++++++++++++++ test/tools/csql/exp.test029.ksh | 101 ++++++++++++++++++++++++++++++++++++++++ test/tools/csql/test029.ksh | 17 +++++++ 3 files changed, 162 insertions(+) create mode 100644 test/tools/csql/agg1.sql create mode 100644 test/tools/csql/exp.test029.ksh create mode 100755 test/tools/csql/test029.ksh diff --git a/test/tools/csql/agg1.sql b/test/tools/csql/agg1.sql new file mode 100644 index 00000000..95993f6b --- /dev/null +++ b/test/tools/csql/agg1.sql @@ -0,0 +1,44 @@ +CREATE TABLE t1 (f1 INT , f2 INT , f3 INT); +INSERT INTO t1 VALUES(1,1,1); +INSERT INTO t1 VALUES(2,1,2); +INSERT INTO t1 VALUES(3,1,3); +INSERT INTO t1 VALUES(5,2,5); +INSERT INTO t1 VALUES(10,2,10); +INSERT INTO t1 VALUES(100,3,100); +INSERT INTO t1 VALUES(200,3,200); +INSERT INTO t1 VALUES(1000,4,1000); +echo select count(f1) from t1; +select count(f1) from t1; +echo select min(f1) from t1; +select min(f1) from t1; +echo select max(f3) from t1; +select max(f3) from t1; +echo select avg(f1) from t1; +select avg(f1) from t1; +echo select sum(f1) from t1; +select sum(f1) from t1; +echo select count(f1) from t1 group by f2; +select count(f1) from t1 group by f2; +echo select min(f1) from t1 group by f2; +select min(f1) from t1 group by f2; +echo select max(f1) from t1 group by f2; +select max(f1) from t1 group by f2; +echo select avg(f1) from t1 group by f2; +echo below stmt dumps core +echo --select avg(f1) from t1 group by f2; +echo select sum(f1) from t1 group by f2; +select sum(f1) from t1 group by f2; +echo select min(f1), max(f3), sum(f1) from t1; +select min(f1), max(f3), sum(f1) from t1; +echo select min(f1), f2, max(f3) from t1; +select min(f1), f2, max(f3) from t1; +echo select min(f1), f2, max(f3) from t1 group by f2; +select min(f1), f2, max(f3) from t1 group by f2; +echo select min(f2) from t1 group by f2; +echo below stmt gives wrong values +select min(f2) from t1 group by f2; +echo select count(*) from t1; +select count(*) from t1; +echo select count(*) from t1 group by f2; +select count(*) from t1 group by f2; +echo test over diff --git a/test/tools/csql/exp.test029.ksh b/test/tools/csql/exp.test029.ksh new file mode 100644 index 00000000..cd29f4b9 --- /dev/null +++ b/test/tools/csql/exp.test029.ksh @@ -0,0 +1,101 @@ +Statement Executed +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo select count(f1) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 8 + +echo select min(f1) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 1 + +echo select max(f3) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 1000 + +echo select avg(f1) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 165 + +echo select sum(f1) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 1321 + +echo select count(f1) from t1 group by f2; +--------------------------------------------------------- + +--------------------------------------------------------- + 3 + 2 + 2 + 1 + +echo select min(f1) from t1 group by f2; +--------------------------------------------------------- + +--------------------------------------------------------- + 1 + 5 + 100 + 1000 + +echo select max(f1) from t1 group by f2; +--------------------------------------------------------- + +--------------------------------------------------------- + 3 + 10 + 200 + 1000 + +echo select avg(f1) from t1 group by f2; +echo select sum(f1) from t1 group by f2; +--------------------------------------------------------- + +--------------------------------------------------------- + 6 + 15 + 300 + 1000 + +echo select min(f1), max(f3), sum(f1) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 1 1000 1321 + +echo select min(f1), f2, max(f3) from t1; +--------------------------------------------------------- + +--------------------------------------------------------- + 1 4 1000 + +echo select min(f1), f2, max(f3) from t1 group by f2; +--------------------------------------------------------- + +--------------------------------------------------------- + 1 1 3 + 5 2 10 + 100 3 200 + 1000 4 1000 + +echo select min(f2) from t1 group by f2; +select min(f2) from t1 group by f2; +echo select count(*) from t1; +echo select count(*) from t1 group by f2; diff --git a/test/tools/csql/test029.ksh b/test/tools/csql/test029.ksh new file mode 100755 index 00000000..71c5ef34 --- /dev/null +++ b/test/tools/csql/test029.ksh @@ -0,0 +1,17 @@ +#!/bin/sh +# Test Case +# check aggegates and group by data type +# +QUITFILE=${PWD}/tools/csql/quit.sql +REL_PATH=. +if [ -s "$QUITFILE" ] +then + REL_PATH=`pwd`/tools/csql +fi + +$CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/agg1.sql +if [ $? -ne 0 ] +then + exit 1; +fi + -- 2.11.4.GIT