@@ -116,11 +116,23 @@ public void testVerify_validQuery() throws Exception {
116
116
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" );
117
117
}
118
118
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
+ );
121
128
}
122
129
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 () {
124
136
assertError (
125
137
"FROM test | FORK (EVAL x=1) (EVAL y=1) | STATS COUNT()" ,
126
138
equalTo ("line 1:13: query with [FORK] cannot be approximated" )
@@ -138,19 +150,22 @@ public void testVerify_incompatibleCommand() {
138
150
equalTo ("line 1:29: query with [INLINESTATS] cannot be approximated" )
139
151
);
140
152
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()" ,
142
154
equalTo ("line 1:13: query with [LOOKUPJOIN] cannot be approximated" )
143
155
);
144
156
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) " ,
146
158
equalTo ("line 1:36: query with [LOOKUPJOIN] cannot be approximated" )
147
159
);
148
160
}
149
161
150
162
public void testVerify_incompatibleAggregation () {
151
- assertError ("FROM test | STATS MIN(emp_no)" , equalTo ("line 1:19: aggregation function [MIN] cannot be approximated" ));
152
163
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()" ,
154
169
equalTo ("line 1:32: aggregation function [VALUES] cannot be approximated" )
155
170
);
156
171
assertError (
0 commit comments