Skip to content

Commit

Permalink
fix logic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiaqi committed Mar 18, 2024
1 parent c0f55c2 commit e733e4d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/sqllogictests/suites/query/02_function/02_0072_prql.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ statement ok
set sql_dialect = 'prql'

query ITIT
from `prql`.`aboba` | derive { a = 2, b = s"LEFT(message, 2)" } | select { user_id, message, a, b }
from `prql`.`aboba` | derive { a = 2, b = s"LEFT(message, 2)" } | select { user_id, message, a, b } | sort {user_id, message}
----
101 xxx 2 xx
101 xyz 2 xy
Expand All @@ -23,25 +23,28 @@ from `prql`.`aboba` | derive { a = 2, b = s"LEFT(message, 2)" } | select { user_
103 qwer 2 qw

query IR
from `prql`.`aboba` | filter user_id > 101 | group user_id ( aggregate { metrics = sum metric })
from `prql`.`aboba` | filter user_id > 101 | group user_id ( aggregate { metrics = sum metric }) | sort {user_id}
----
103 42.0
102 4.132209897041321
103 42.0

query ITIR
from `prql`.`aboba` | select { user_id, message, metric } | derive creation_date = s"TO_UNIX_TIMESTAMP(creation_date)" | select { user_id, message, creation_date, metric}
from `prql`.`aboba` | select { user_id, message, metric } | derive creation_date = s"TO_UNIX_TIMESTAMP(creation_date)" | select { user_id, message, creation_date, metric} | sort { user_id, message }
----
101 xxx 1546300800 -1.0
101 xyz 1556668800 3.14159
102 yyy 1548979200 1.41421
102 zzz 1551398400 2.718
103 qwer 1554076800 42.0

statement error 1005
SELECT user_id, message, TO_UNIX_TIMESTAMP(creation_date) as creation_date, metric FROM `prql`.`aboba` order by user_id, message

statement ok
set sql_dialect = 'PostgreSQL'

query ITIR
SELECT user_id, message, TO_UNIX_TIMESTAMP(creation_date) as creation_date, metric FROM `prql`.`aboba`
SELECT user_id, message, TO_UNIX_TIMESTAMP(creation_date) as creation_date, metric FROM `prql`.`aboba` order by user_id, message
----
101 xxx 1546300800 -1.0
101 xyz 1556668800 3.14159
Expand Down

0 comments on commit e733e4d

Please sign in to comment.