parSelectTest.cpp 13.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "parTestUtil.h"

using namespace std;

namespace ParserTest {

class ParserSelectTest : public ParserTestBase {};

TEST_F(ParserSelectTest, basic) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
27
  run("SELECT * FROM t1");
28

X
Xiaoyu Wang 已提交
29
  run("SELECT * FROM test.t1");
30

X
Xiaoyu Wang 已提交
31
  run("SELECT ts, c1 FROM t1");
32

X
Xiaoyu Wang 已提交
33
  run("SELECT ts, t.c1 FROM (SELECT * FROM t1) t");
34

X
Xiaoyu Wang 已提交
35
  run("SELECT * FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1");
X
Xiaoyu Wang 已提交
36 37

  run("SELECT * FROM st1");
38 39 40 41 42
}

TEST_F(ParserSelectTest, constant) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
43
  run("SELECT 123, 20.4, 'abc', \"wxy\", timestamp '2022-02-09 17:30:20', true, false, 10s FROM t1");
44

X
Xiaoyu Wang 已提交
45 46
  run("SELECT 1234567890123456789012345678901234567890, 20.1234567890123456789012345678901234567890, 'abc', \"wxy\", "
      "timestamp '2022-02-09 17:30:20', true, false, 15s FROM t1");
47

X
Xiaoyu Wang 已提交
48
  run("SELECT 123 + 45 FROM t1 WHERE 2 - 1");
49 50

  run("SELECT * FROM t1 WHERE -2");
51 52 53 54 55
}

TEST_F(ParserSelectTest, expression) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
56
  run("SELECT ts + 10s, c1 + 10, concat(c2, 'abc') FROM t1");
57

X
Xiaoyu Wang 已提交
58
  run("SELECT ts > 0, c1 < 20 and c2 = 'qaz' FROM t1");
59

X
Xiaoyu Wang 已提交
60
  run("SELECT ts > 0, c1 between 10 and 20 and c2 = 'qaz' FROM t1");
61 62 63 64 65
}

TEST_F(ParserSelectTest, condition) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
66
  run("SELECT c1 FROM t1 WHERE ts in (true, false)");
67

X
Xiaoyu Wang 已提交
68 69
  run("SELECT c1 FROM t1 WHERE NOT ts in (true, false)");

X
Xiaoyu Wang 已提交
70
  run("SELECT * FROM t1 WHERE c1 > 10 and c1 is not null");
71 72 73 74 75
}

TEST_F(ParserSelectTest, pseudoColumn) {
  useDb("root", "test");

76
  run("SELECT _WSTARTTS, _WENDTS, COUNT(*) FROM t1 INTERVAL(10s)");
77 78
}

79 80 81
TEST_F(ParserSelectTest, pseudoColumnSemanticCheck) {
  useDb("root", "test");

82
  run("SELECT TBNAME FROM (SELECT * FROM st1s1)", TSDB_CODE_PAR_INVALID_TBNAME, PARSER_STAGE_TRANSLATE);
83 84
}

85 86 87 88 89 90
TEST_F(ParserSelectTest, aggFunc) {
  useDb("root", "test");

  run("SELECT LEASTSQUARES(c1, -1, 1) FROM t1");
}

91 92 93
TEST_F(ParserSelectTest, multiResFunc) {
  useDb("root", "test");

94
  run("SELECT LAST(*), FIRST(*), LAST_ROW(*) FROM t1");
95

96
  run("SELECT LAST(c1, c2), FIRST(t1.*), LAST_ROW(c3) FROM t1");
97

98
  run("SELECT LAST(t2.*), FIRST(t1.c1, t2.*), LAST_ROW(t1.*, t2.*) FROM st1s1 t1, st1s2 t2 WHERE t1.ts = t2.ts");
99 100
}

X
Xiaoyu Wang 已提交
101 102 103
TEST_F(ParserSelectTest, timelineFunc) {
  useDb("root", "test");

104
  run("SELECT LAST(*), FIRST(*) FROM t1");
X
Xiaoyu Wang 已提交
105

106
  run("SELECT FIRST(ts), FIRST(c1), FIRST(c2), FIRST(c3) FROM t1");
X
Xiaoyu Wang 已提交
107

108 109 110
  run("SELECT LAST(*), FIRST(*) FROM t1 GROUP BY c1");

  run("SELECT LAST(*), FIRST(*) FROM t1 INTERVAL(10s)");
X
Xiaoyu Wang 已提交
111

X
Xiaoyu Wang 已提交
112
  run("SELECT diff(c1) FROM t1");
X
Xiaoyu Wang 已提交
113 114
}

115 116
TEST_F(ParserSelectTest, selectFunc) {
  useDb("root", "test");
117

118 119 120 121 122 123 124 125 126
  // select function
  run("SELECT MAX(c1), MIN(c1) FROM t1");
  // select function for GROUP BY clause
  run("SELECT MAX(c1), MIN(c1) FROM t1 GROUP BY c1");
  // select function for INTERVAL clause
  run("SELECT MAX(c1), MIN(c1) FROM t1 INTERVAL(10s)");
  // select function along with the columns of select row
  run("SELECT MAX(c1), c2 FROM t1");
  run("SELECT MAX(c1), t1.* FROM t1");
127 128 129 130 131 132 133
  // select function along with the columns of select row, and with GROUP BY clause
  run("SELECT MAX(c1), c2 FROM t1 GROUP BY c3");
  run("SELECT MAX(c1), t1.* FROM t1 GROUP BY c3");
  // select function along with the columns of select row, and with window clause
  run("SELECT MAX(c1), c2 FROM t1 INTERVAL(10s)");
  run("SELECT MAX(c1), c2 FROM t1 SESSION(ts, 10s)");
  run("SELECT MAX(c1), c2 FROM t1 STATE_WINDOW(c3)");
134 135
}

X
Xiaoyu Wang 已提交
136
TEST_F(ParserSelectTest, IndefiniteRowsFunc) {
137 138 139 140 141
  useDb("root", "test");

  run("SELECT DIFF(c1) FROM t1");
}

X
Xiaoyu Wang 已提交
142
TEST_F(ParserSelectTest, IndefiniteRowsFuncSemanticCheck) {
143 144 145 146 147 148 149 150 151
  useDb("root", "test");

  run("SELECT DIFF(c1), c2 FROM t1", TSDB_CODE_PAR_NOT_ALLOWED_FUNC, PARSER_STAGE_TRANSLATE);

  run("SELECT DIFF(c1), tbname FROM t1", TSDB_CODE_PAR_NOT_ALLOWED_FUNC, PARSER_STAGE_TRANSLATE);

  run("SELECT DIFF(c1), count(*) FROM t1", TSDB_CODE_PAR_NOT_ALLOWED_FUNC, PARSER_STAGE_TRANSLATE);

  run("SELECT DIFF(c1), CSUM(c1) FROM t1", TSDB_CODE_PAR_NOT_ALLOWED_FUNC, PARSER_STAGE_TRANSLATE);
152 153

  // run("SELECT DIFF(c1) FROM t1 INTERVAL(10s)");
154 155
}

156 157 158 159 160 161 162 163
TEST_F(ParserSelectTest, useDefinedFunc) {
  useDb("root", "test");

  run("SELECT udf1(c1) FROM t1");

  run("SELECT udf2(c1) FROM t1 GROUP BY c2");
}

164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
TEST_F(ParserSelectTest, uniqueFunc) {
  useDb("root", "test");

  run("SELECT UNIQUE(c1) FROM t1");

  run("SELECT UNIQUE(c2 + 10) FROM t1 WHERE c1 > 10");

  run("SELECT UNIQUE(c2 + 10), ts, c2 FROM t1 WHERE c1 > 10");
}

TEST_F(ParserSelectTest, uniqueFuncSemanticCheck) {
  useDb("root", "test");

  run("SELECT UNIQUE(c1) FROM t1 INTERVAL(10S)", TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC);

  run("SELECT UNIQUE(c1) FROM t1 GROUP BY c2", TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC);
}

TEST_F(ParserSelectTest, tailFunc) {
  useDb("root", "test");

  run("SELECT TAIL(c1, 10) FROM t1");

  run("SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10");
}

TEST_F(ParserSelectTest, tailFuncSemanticCheck) {
  useDb("root", "test");

  run("SELECT TAIL(c1, 10) FROM t1 INTERVAL(10S)", TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC);

  run("SELECT TAIL(c1, 10) FROM t1 GROUP BY c2", TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC);
}

198
TEST_F(ParserSelectTest, groupBy) {
199 200
  useDb("root", "test");

X
Xiaoyu Wang 已提交
201
  run("SELECT COUNT(*) cnt FROM t1 WHERE c1 > 0");
202

203
  run("SELECT COUNT(*), c2 cnt FROM t1 WHERE c1 > 0 GROUP BY c2");
204

205
  run("SELECT COUNT(*) cnt FROM t1 WHERE c1 > 0 GROUP BY c2 having COUNT(c1) > 10");
206

207
  run("SELECT COUNT(*), c1, c2 + 10, c1 + c2 cnt FROM t1 WHERE c1 > 0 GROUP BY c2, c1");
208

209
  run("SELECT COUNT(*), c1 + 10, c2 cnt FROM t1 WHERE c1 > 0 GROUP BY c1 + 10, c2");
210 211 212 213
}

TEST_F(ParserSelectTest, orderBy) {
  useDb("root", "test");
214

215
  run("SELECT COUNT(*) cnt FROM t1 WHERE c1 > 0 GROUP BY c2 order by cnt");
216

217
  run("SELECT COUNT(*) cnt FROM t1 WHERE c1 > 0 GROUP BY c2 order by 1");
218 219 220 221
}

TEST_F(ParserSelectTest, distinct) {
  useDb("root", "test");
222

X
Xiaoyu Wang 已提交
223
  // run("SELECT distinct c1, c2 FROM t1 WHERE c1 > 0 order by c1");
224

X
Xiaoyu Wang 已提交
225
  // run("SELECT distinct c1 + 10, c2 FROM t1 WHERE c1 > 0 order by c1 + 10, c2");
226

X
Xiaoyu Wang 已提交
227
  // run("SELECT distinct c1 + 10 cc1, c2 cc2 FROM t1 WHERE c1 > 0 order by cc1, c2");
228

229
  // run("SELECT distinct COUNT(c2) FROM t1 WHERE c1 > 0 GROUP BY c1 order by COUNT(c2)");
230 231
}

X
Xiaoyu Wang 已提交
232 233 234 235
// INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
// fill_mod_and_val = { NONE | PREV | NULL | LINEAR | NEXT | value_mod }
// value_mod = VALUE , val ...
TEST_F(ParserSelectTest, interval) {
236
  useDb("root", "test");
X
Xiaoyu Wang 已提交
237 238 239 240 241 242 243
  // INTERVAL(interval_val)
  run("SELECT COUNT(*) FROM t1 INTERVAL(10s)");
  // INTERVAL(interval_val, interval_offset)
  run("SELECT COUNT(*) FROM t1 INTERVAL(10s, 5s)");
  // INTERVAL(interval_val, interval_offset) SLIDING (sliding_val)
  run("SELECT COUNT(*) FROM t1 INTERVAL(10s, 5s) SLIDING(7s)");
  // INTERVAL(interval_val) FILL(NONE)
X
Xiaoyu Wang 已提交
244 245
  run("SELECT COUNT(*) FROM t1 WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' "
      "INTERVAL(10s) FILL(NONE)");
246 247
}

248 249 250
TEST_F(ParserSelectTest, intervalSemanticCheck) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
251 252 253 254 255
  run("SELECT c1 FROM t1 INTERVAL(10s)", TSDB_CODE_PAR_NOT_SINGLE_GROUP);
  run("SELECT DISTINCT c1, c2 FROM t1 WHERE c1 > 3 INTERVAL(1d) FILL(NEXT)", TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE);
  run("SELECT HISTOGRAM(c1, 'log_bin', '{\"start\": -33,\"factor\": 55,\"count\": 5,\"infinity\": false}', 1) FROM t1 "
      "WHERE ts > TIMESTAMP '2022-04-01 00:00:00' and ts < TIMESTAMP '2022-04-30 23:59:59' INTERVAL(10s) FILL(NULL)",
      TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC);
X
Xiaoyu Wang 已提交
256
  run("SELECT _WSTARTTS, _WENDTS, _WDURATION, sum(c1) FROM t1", TSDB_CODE_PAR_INVALID_WINDOW_PC);
257 258
}

X
Xiaoyu Wang 已提交
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
TEST_F(ParserSelectTest, interp) {
  useDb("root", "test");

  run("SELECT INTERP(c1) FROM t1");

  run("SELECT INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00')");

  run("SELECT INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00') FILL(LINEAR)");

  run("SELECT INTERP(c1) FROM t1 EVERY(5s)");

  run("SELECT INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00') EVERY(5s)");

  run("SELECT INTERP(c1) FROM t1 RANGE('2017-7-14 18:00:00', '2017-7-14 19:00:00') EVERY(5s) FILL(LINEAR)");
}

275 276 277 278 279 280 281 282 283 284
TEST_F(ParserSelectTest, subquery) {
  useDb("root", "test");

  run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 INTERVAL(1m)) INTERVAL(1n)");

  run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstartts FROM st1s1 INTERVAL(1m)) INTERVAL(1n)");

  run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");

  run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstartts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");
X
Xiaoyu Wang 已提交
285 286 287 288

  run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)");

  run("SELECT ts FROM (SELECT t1.ts FROM st1s1 t1)");
289 290
}

X
Xiaoyu Wang 已提交
291
TEST_F(ParserSelectTest, subquerySemanticCheck) {
292 293
  useDb("root", "test");

X
Xiaoyu Wang 已提交
294 295 296 297 298 299 300
  run("SELECT SUM(a) FROM (SELECT MAX(c1) a FROM st1s1 INTERVAL(1m)) INTERVAL(1n)",
      TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY);

  run("SELECT ts FROM (SELECT t1.ts AS ts, t2.ts FROM st1s1 t1, st1s2 t2 WHERE t1.ts = t2.ts)",
      TSDB_CODE_PAR_AMBIGUOUS_COLUMN);

  run("SELECT ts FROM (SELECT ts AS c1 FROM st1s1 t1)", TSDB_CODE_PAR_INVALID_COLUMN);
301 302
}

X
Xiaoyu Wang 已提交
303
TEST_F(ParserSelectTest, semanticCheck) {
304 305 306
  useDb("root", "test");

  // TSDB_CODE_PAR_INVALID_COLUMN
X
Xiaoyu Wang 已提交
307
  run("SELECT c1, cc1 FROM t1", TSDB_CODE_PAR_INVALID_COLUMN, PARSER_STAGE_TRANSLATE);
308

X
Xiaoyu Wang 已提交
309
  run("SELECT t1.c1, t1.cc1 FROM t1", TSDB_CODE_PAR_INVALID_COLUMN, PARSER_STAGE_TRANSLATE);
310 311

  // TSDB_CODE_PAR_TABLE_NOT_EXIST
X
Xiaoyu Wang 已提交
312
  run("SELECT * FROM t10", TSDB_CODE_PAR_TABLE_NOT_EXIST, PARSER_STAGE_TRANSLATE);
313

X
Xiaoyu Wang 已提交
314
  run("SELECT * FROM test.t10", TSDB_CODE_PAR_TABLE_NOT_EXIST, PARSER_STAGE_TRANSLATE);
315

X
Xiaoyu Wang 已提交
316
  run("SELECT t2.c1 FROM t1", TSDB_CODE_PAR_TABLE_NOT_EXIST, PARSER_STAGE_TRANSLATE);
317 318

  // TSDB_CODE_PAR_AMBIGUOUS_COLUMN
X
Xiaoyu Wang 已提交
319
  run("SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1", TSDB_CODE_PAR_AMBIGUOUS_COLUMN, PARSER_STAGE_TRANSLATE);
320

321 322
  run("SELECT c2 FROM (SELECT c1 c2, c2 FROM t1)", TSDB_CODE_PAR_AMBIGUOUS_COLUMN, PARSER_STAGE_TRANSLATE);

323
  // TSDB_CODE_PAR_WRONG_VALUE_TYPE
324
  run("SELECT timestamp '2010a' FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);
325

326 327 328 329
  run("SELECT LAST(*) + SUM(c1) FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);

  run("SELECT CEIL(LAST(ts, c1)) FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);

330
  // TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
X
Xiaoyu Wang 已提交
331
  run("SELECT c2 FROM t1 tt1 join t1 tt2 on COUNT(*) > 0", TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION,
332 333
      PARSER_STAGE_TRANSLATE);

X
Xiaoyu Wang 已提交
334
  run("SELECT c2 FROM t1 WHERE COUNT(*) > 0", TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, PARSER_STAGE_TRANSLATE);
335

336
  run("SELECT c2 FROM t1 GROUP BY COUNT(*)", TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, PARSER_STAGE_TRANSLATE);
337 338

  // TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT
X
Xiaoyu Wang 已提交
339
  run("SELECT c2 FROM t1 order by 0", TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT, PARSER_STAGE_TRANSLATE);
340

X
Xiaoyu Wang 已提交
341
  run("SELECT c2 FROM t1 order by 2", TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT, PARSER_STAGE_TRANSLATE);
342 343

  // TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION
X
Xiaoyu Wang 已提交
344
  run("SELECT COUNT(*) cnt FROM t1 having c1 > 0", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION, PARSER_STAGE_TRANSLATE);
345

346
  run("SELECT COUNT(*) cnt FROM t1 GROUP BY c2 having c1 > 0", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION,
347 348
      PARSER_STAGE_TRANSLATE);

349
  run("SELECT COUNT(*), c1 cnt FROM t1 GROUP BY c2 having c2 > 0", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION,
350 351
      PARSER_STAGE_TRANSLATE);

352
  run("SELECT COUNT(*) cnt FROM t1 GROUP BY c2 having c2 > 0 order by c1", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION,
353 354 355
      PARSER_STAGE_TRANSLATE);

  // TSDB_CODE_PAR_NOT_SINGLE_GROUP
X
Xiaoyu Wang 已提交
356
  run("SELECT COUNT(*), c1 FROM t1", TSDB_CODE_PAR_NOT_SINGLE_GROUP, PARSER_STAGE_TRANSLATE);
357

X
Xiaoyu Wang 已提交
358
  run("SELECT COUNT(*) FROM t1 order by c1", TSDB_CODE_PAR_NOT_SINGLE_GROUP, PARSER_STAGE_TRANSLATE);
359

X
Xiaoyu Wang 已提交
360
  run("SELECT c1 FROM t1 order by COUNT(*)", TSDB_CODE_PAR_NOT_SINGLE_GROUP, PARSER_STAGE_TRANSLATE);
361 362

  // TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION
X
Xiaoyu Wang 已提交
363
  run("SELECT distinct c1, c2 FROM t1 WHERE c1 > 0 order by ts", TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION,
364 365
      PARSER_STAGE_TRANSLATE);

X
Xiaoyu Wang 已提交
366
  run("SELECT distinct c1 FROM t1 WHERE c1 > 0 order by COUNT(c2)", TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION,
367 368
      PARSER_STAGE_TRANSLATE);

X
Xiaoyu Wang 已提交
369
  run("SELECT distinct c2 FROM t1 WHERE c1 > 0 order by COUNT(c2)", TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION,
370 371 372
      PARSER_STAGE_TRANSLATE);
}

X
Xiaoyu Wang 已提交
373 374 375
TEST_F(ParserSelectTest, setOperator) {
  useDb("root", "test");

X
Xiaoyu Wang 已提交
376
  run("SELECT * FROM t1 UNION ALL SELECT * FROM t1");
X
Xiaoyu Wang 已提交
377

X
Xiaoyu Wang 已提交
378
  run("(SELECT * FROM t1) UNION ALL (SELECT * FROM t1)");
379 380

  run("SELECT c1 FROM (SELECT c1 FROM t1 UNION ALL SELECT c1 FROM t1)");
381 382

  run("SELECT c1, c2 FROM t1 UNION ALL SELECT c1 as a, c2 as b FROM t1 ORDER BY c1");
X
Xiaoyu Wang 已提交
383 384
}

X
Xiaoyu Wang 已提交
385 386 387 388 389 390
TEST_F(ParserSelectTest, informationSchema) {
  useDb("root", "test");

  run("SELECT * FROM information_schema.user_databases WHERE name = 'information_schema'");
}

391 392 393 394 395 396
TEST_F(ParserSelectTest, withoutFrom) {
  useDb("root", "test");

  run("SELECT 1");
}

397
}  // namespace ParserTest