Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
c566ad4b
Commit
c566ad4b
authored
10 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
test fix
parent
aed3ad76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/driver/generic_sql/query_processor_test.clj
+12
-21
12 additions, 21 deletions
test/metabase/driver/generic_sql/query_processor_test.clj
with
12 additions
and
21 deletions
test/metabase/driver/generic_sql/query_processor_test.clj
+
12
−
21
View file @
c566ad4b
(
ns
metabase.driver.generic-sql.query-processor-test
(
:require
[
expectations
:refer
:all
]
[
metabase.driver.generic-sql.query-processor
:refer
:all
]
[
metabase.test-data
:refer
[
db-id
table->id
field->id
]]
[
metabase.
driver.generic-sql.query-processor
:refer
:all
]
))
metabase.
test-setup
))
;; ## "COUNT" AGGREGATION
(
expect
{
:status
:completed
...
...
@@ -400,26 +401,16 @@
:aggregation
[
"cum_sum"
(
field->id
:users
:id
)]}}))
;; ### Cumulative sum w/ a breakout field
(
expect
{
:status
:completed,
:row_count
15
,
:data
{
:rows
[[
4
#
inst
"2014-01-01T08:00:00.000-00:00"
]
; incidentally this also tests that the QP is casting timestamps -> date
[
12
#
inst
"2014-02-01T08:00:00.000-00:00"
]
[
13
#
inst
"2014-04-01T07:00:00.000-00:00"
]
[
22
#
inst
"2014-04-03T07:00:00.000-00:00"
]
[
34
#
inst
"2014-07-02T07:00:00.000-00:00"
]
[
44
#
inst
"2014-07-03T07:00:00.000-00:00"
]
[
57
#
inst
"2014-08-01T07:00:00.000-00:00"
]
[
72
#
inst
"2014-08-01T07:00:00.000-00:00"
]
[
78
#
inst
"2014-08-02T07:00:00.000-00:00"
]
[
85
#
inst
"2014-08-02T07:00:00.000-00:00"
]
[
90
#
inst
"2014-10-03T07:00:00.000-00:00"
]
[
104
#
inst
"2014-10-03T07:00:00.000-00:00"
]
[
115
#
inst
"2014-11-01T07:00:00.000-00:00"
]
[
118
#
inst
"2014-11-06T08:00:00.000-00:00"
]
[
120
#
inst
"2014-12-05T08:00:00.000-00:00"
]]
:columns
[
"ID"
"CAST(LAST_LOGIN AS DATE)"
]
:cols
[{
:special_type
"id"
,
:base_type
"IntegerField"
,
:description
nil,
:name
"ID"
,
:table_id
(
table->id
:users
)
,
:id
(
field->id
:users
:id
)}
{
:special_type
nil,
:base_type
"DateTimeField"
,
:description
nil,
:name
"LAST_LOGIN"
,
:table_id
(
table->id
:users
)
,
:id
(
field->id
:users
:last_login
)}]}}
;; incidentally this also tests that the QP is casting timestamps -> date
(
expect
(
let
[
sorted-user-timestamps
(
->>
metabase.test-data.data/test-data
:users
:rows
(
map
last
)
sort
)]
{
:status
:completed,
:row_count
15
,
:data
{
:rows
(
map
vector
; convert to a seq like [[4 timestamp-1] [12 timestamp-2] ...]
[
4
12
13
22
34
44
57
72
78
85
90
104
115
118
120
]
; by pairing values with corresponding ordered timestamp
sorted-user-timestamps
)
; that way we don't have to hard code the last_logins here
:columns
[
"ID"
"CAST(LAST_LOGIN AS DATE)"
]
:cols
[{
:special_type
"id"
,
:base_type
"IntegerField"
,
:description
nil,
:name
"ID"
,
:table_id
(
table->id
:users
)
,
:id
(
field->id
:users
:id
)}
{
:special_type
nil,
:base_type
"DateTimeField"
,
:description
nil,
:name
"LAST_LOGIN"
,
:table_id
(
table->id
:users
)
,
:id
(
field->id
:users
:last_login
)}]}})
(
process-and-run
{
:type
:query
:database
@
db-id
:query
{
:limit
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment