Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/test_475/model.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:1:{i:0;a:10:{i:0;a:2:{s:8:"sphinxql";s:31:"CREATE TABLE t (grp INT, v INT)";s:14:"total_affected";i:0;}i:1;a:2:{s:8:"sphinxql";s:65:"INSERT INTO t VALUES (1,1,10),(2,1,20),(3,2,5),(4,2,5),(5,3,100)";s:14:"total_affected";i:5;}i:2;a:3:{s:8:"sphinxql";s:43:"SELECT grp, SUM(v) AS s FROM t GROUP BY grp";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:2:{s:3:"grp";s:1:"1";s:1:"s";s:2:"30";}i:1;a:2:{s:3:"grp";s:1:"2";s:1:"s";s:2:"10";}i:2;a:2:{s:3:"grp";s:1:"3";s:1:"s";s:3:"100";}}}i:3;a:3:{s:8:"sphinxql";s:57:"SELECT grp, SUM(v) AS s FROM t GROUP BY grp HAVING s > 20";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:3:"grp";s:1:"1";s:1:"s";s:2:"30";}i:1;a:2:{s:3:"grp";s:1:"3";s:1:"s";s:3:"100";}}}i:4;a:3:{s:8:"sphinxql";s:9:"SHOW META";s:10:"total_rows";i:4;s:4:"rows";a:3:{i:0;a:2:{s:13:"Variable_name";s:5:"total";s:5:"Value";s:1:"2";}i:1;a:2:{s:13:"Variable_name";s:11:"total_found";s:5:"Value";s:1:"2";}i:2;a:2:{s:13:"Variable_name";s:14:"total_relation";s:5:"Value";s:2:"eq";}}}i:5;a:2:{s:8:"sphinxql";s:12:"DROP TABLE t";s:14:"total_affected";i:0;}i:6;a:2:{s:8:"sphinxql";s:28:"create table t(a int, b int)";s:14:"total_affected";i:0;}i:7;a:2:{s:8:"sphinxql";s:27:"insert into t values(0,1,2)";s:14:"total_affected";i:1;}i:8;a:3:{s:8:"sphinxql";s:73:"select a, count(*) from t where a=1 or b=2 group by a having count(*) = 1";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:1:"a";s:1:"1";s:8:"count(*)";s:1:"1";}}}i:9;a:2:{s:8:"sphinxql";s:12:"drop table t";s:14:"total_affected";i:0;}}}
37 changes: 37 additions & 0 deletions test/test_475/test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<test>

<name>HAVING vs total_found</name>

<requires>
<force-rt/>
</requires>

<skip_indexer/>

<config>
searchd
{
<searchd_Settings/>
data_dir = <data_path path="data0"/>
}
</config>

<queries>
<sphinxql>
CREATE TABLE t (grp INT, v INT);
INSERT INTO t VALUES (1,1,10),(2,1,20),(3,2,5),(4,2,5),(5,3,100);
SELECT grp, SUM(v) AS s FROM t GROUP BY grp;
SELECT grp, SUM(v) AS s FROM t GROUP BY grp HAVING s > 20;
SHOW META;
DROP TABLE t;

<!-- regression for 'filter with empty name' -->
create table t(a int, b int);
insert into t values(0,1,2);
select a, count(*) from t where a=1 or b=2 group by a having count(*) = 1;
drop table t;
</sphinxql>
</queries>

</test>