Skip to content

Commit 8e414ac

Browse files
committed
Fix
1 parent feccbc8 commit 8e414ac

2 files changed

Lines changed: 48 additions & 16 deletions

File tree

sql/core/src/test/resources/sql-tests/inputs/interval.sql renamed to sql/core/src/test/resources/sql-tests/inputs/ansi/interval.sql

File renamed without changes.

sql/core/src/test/resources/sql-tests/results/interval.sql.out renamed to sql/core/src/test/resources/sql-tests/results/ansi/interval.sql.out

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,15 @@ interval 4 weeks 2 days
290290
-- !query 22
291291
select 30 day day
292292
-- !query 22 schema
293-
struct<day:calendarinterval>
293+
struct<>
294294
-- !query 22 output
295-
interval 4 weeks 2 days
295+
org.apache.spark.sql.catalyst.parser.ParseException
296+
297+
no viable alternative at input 'day'(line 1, pos 14)
298+
299+
== SQL ==
300+
select 30 day day
301+
--------------^^^
296302

297303

298304
-- !query 23
@@ -302,11 +308,11 @@ struct<>
302308
-- !query 23 output
303309
org.apache.spark.sql.catalyst.parser.ParseException
304310

305-
extraneous input 'day' expecting <EOF>(line 1, pos 18)
311+
no viable alternative at input 'day'(line 1, pos 14)
306312

307313
== SQL ==
308314
select 30 day day day
309-
------------------^^^
315+
--------------^^^
310316

311317

312318
-- !query 24
@@ -320,9 +326,15 @@ struct<CAST(CAST(DATE '2012-01-01' AS TIMESTAMP) - interval 4 weeks 2 days AS DA
320326
-- !query 25
321327
select date '2012-01-01' - 30 day day
322328
-- !query 25 schema
323-
struct<day:date>
329+
struct<>
324330
-- !query 25 output
325-
2011-12-02
331+
org.apache.spark.sql.catalyst.parser.ParseException
332+
333+
no viable alternative at input 'day'(line 1, pos 34)
334+
335+
== SQL ==
336+
select date '2012-01-01' - 30 day day
337+
----------------------------------^^^
326338

327339

328340
-- !query 26
@@ -332,11 +344,11 @@ struct<>
332344
-- !query 26 output
333345
org.apache.spark.sql.catalyst.parser.ParseException
334346

335-
extraneous input 'day' expecting <EOF>(line 1, pos 38)
347+
no viable alternative at input 'day'(line 1, pos 34)
336348

337349
== SQL ==
338350
select date '2012-01-01' - 30 day day day
339-
--------------------------------------^^^
351+
----------------------------------^^^
340352

341353

342354
-- !query 27
@@ -360,17 +372,27 @@ select date '2012-01-01' + interval (-30) day
360372
-- !query 29 schema
361373
struct<>
362374
-- !query 29 output
363-
org.apache.spark.sql.AnalysisException
364-
Undefined function: 'interval'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.; line 1 pos 27
375+
org.apache.spark.sql.catalyst.parser.ParseException
376+
377+
no viable alternative at input 'day'(line 1, pos 42)
378+
379+
== SQL ==
380+
select date '2012-01-01' + interval (-30) day
381+
------------------------------------------^^^
365382

366383

367384
-- !query 30
368385
select date '2012-01-01' + (-30) day
369386
-- !query 30 schema
370387
struct<>
371388
-- !query 30 output
372-
org.apache.spark.sql.AnalysisException
373-
cannot resolve '(DATE '2012-01-01' + -30)' due to data type mismatch: differing types in '(DATE '2012-01-01' + -30)' (date and int).; line 1 pos 7
389+
org.apache.spark.sql.catalyst.parser.ParseException
390+
391+
no viable alternative at input 'day'(line 1, pos 33)
392+
393+
== SQL ==
394+
select date '2012-01-01' + (-30) day
395+
---------------------------------^^^
374396

375397

376398
-- !query 31
@@ -386,17 +408,27 @@ select date '2012-01-01' + interval (a + 1) day from t
386408
-- !query 32 schema
387409
struct<>
388410
-- !query 32 output
389-
org.apache.spark.sql.AnalysisException
390-
Undefined function: 'interval'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.; line 1 pos 27
411+
org.apache.spark.sql.catalyst.parser.ParseException
412+
413+
no viable alternative at input 'day'(line 1, pos 44)
414+
415+
== SQL ==
416+
select date '2012-01-01' + interval (a + 1) day from t
417+
--------------------------------------------^^^
391418

392419

393420
-- !query 33
394421
select date '2012-01-01' + (a + 1) day from t
395422
-- !query 33 schema
396423
struct<>
397424
-- !query 33 output
398-
org.apache.spark.sql.AnalysisException
399-
cannot resolve '(DATE '2012-01-01' + (t.`a` + 1))' due to data type mismatch: differing types in '(DATE '2012-01-01' + (t.`a` + 1))' (date and int).; line 1 pos 7
425+
org.apache.spark.sql.catalyst.parser.ParseException
426+
427+
no viable alternative at input 'day'(line 1, pos 35)
428+
429+
== SQL ==
430+
select date '2012-01-01' + (a + 1) day from t
431+
-----------------------------------^^^
400432

401433

402434
-- !query 34

0 commit comments

Comments
 (0)