@@ -116,11 +116,23 @@ public void testVerify_validQuery() throws Exception {
116116 createApproximate ("ROW i=[1,2,3] | EVAL x=TO_STRING(i) | DISSECT x \" %{x}\" | STATS i=10*POW(PERCENTILE(i, 0.5), 2) | LIMIT 10" );
117117 }
118118
119- public void testVerify_noStats () {
120- assertError ("FROM test | EVAL x = 1 | SORT emp_no" , equalTo ("line 1:1: query without [STATS] cannot be approximated" ));
119+ public void testVerify_exactlyOneStats () {
120+ assertError (
121+ "FROM test | EVAL x = 1 | SORT emp_no | LIMIT 100 | MV_EXPAND x" ,
122+ equalTo ("line 1:1: query without [STATS] cannot be approximated" )
123+ );
124+ assertError (
125+ "FROM test | STATS COUNT() BY emp_no | STATS COUNT()" ,
126+ equalTo ("line 1:39: query with multiple [STATS] cannot be approximated" )
127+ );
121128 }
122129
123- public void testVerify_incompatibleCommand () {
130+ public void testVerify_incompatibleSourceCommand () {
131+ assertError ("SHOW INFO | STATS COUNT()" , equalTo ("line 1:1: query with [SHOWINFO] cannot be approximated" ));
132+ assertError ("TS test | STATS COUNT(emp_no)" , equalTo ("line 1:11: query with [TIMESERIESAGGREGATE] cannot be approximated" ));
133+ }
134+
135+ public void testVerify_incompatibleProcessingCommand () {
124136 assertError (
125137 "FROM test | FORK (EVAL x=1) (EVAL y=1) | STATS COUNT()" ,
126138 equalTo ("line 1:13: query with [FORK] cannot be approximated" )
@@ -138,19 +150,22 @@ public void testVerify_incompatibleCommand() {
138150 equalTo ("line 1:29: query with [INLINESTATS] cannot be approximated" )
139151 );
140152 assertError (
141- "FROM test | LOOKUP JOIN test_lookup ON emp_no | STATS COUNT()" ,
153+ "FROM test | LOOKUP JOIN test_lookup ON emp_no | FORK (EVAL x=1) (EVAL y=1) | STATS COUNT()" ,
142154 equalTo ("line 1:13: query with [LOOKUPJOIN] cannot be approximated" )
143155 );
144156 assertError (
145- "FROM test | STATS emp_no=COUNT() | LOOKUP JOIN test_lookup ON emp_no" ,
157+ "FROM test | STATS emp_no=COUNT() | LOOKUP JOIN test_lookup ON emp_no | FORK (EVAL x=1) (EVAL y=1) " ,
146158 equalTo ("line 1:36: query with [LOOKUPJOIN] cannot be approximated" )
147159 );
148160 }
149161
150162 public void testVerify_incompatibleAggregation () {
151- assertError ("FROM test | STATS MIN(emp_no)" , equalTo ("line 1:19: aggregation function [MIN] cannot be approximated" ));
152163 assertError (
153- "FROM test | STATS SUM(emp_no), VALUES(emp_no), COUNT()" ,
164+ "FROM test | SORT emp_no STATS MIN(emp_no) | LIMIT 100" ,
165+ equalTo ("line 1:19: aggregation function [MIN] cannot be approximated" )
166+ );
167+ assertError (
168+ "FROM test | STATS SUM(emp_no), VALUES(emp_no), TOP(emp_no, 2, \" ASC\" ), COUNT()" ,
154169 equalTo ("line 1:32: aggregation function [VALUES] cannot be approximated" )
155170 );
156171 assertError (
0 commit comments