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
7537c452
Commit
7537c452
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
test fix
parent
66c2ccff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/query_processor.clj
+3
-4
3 additions, 4 deletions
src/metabase/driver/query_processor.clj
src/metabase/driver/query_processor/expand.clj
+7
-6
7 additions, 6 deletions
src/metabase/driver/query_processor/expand.clj
with
10 additions
and
10 deletions
src/metabase/driver/query_processor.clj
+
3
−
4
View file @
7537c452
...
...
@@ -69,15 +69,15 @@
(
defn-
pre-add-implicit-fields
"Add an implicit `fields` clause to queries with `rows` aggregations."
[
qp
]
(
fn
[{{
:keys
[
fields
breakout
]
,
{
source-table-id
:id
}
:source-table,
{
ag-type
:aggregation-type
}
:aggregation
}
:query,
:as
query
}]
(
fn
[{{
:keys
[
fields
breakout
source-table
]
,
{
source-table-id
:id
}
:source-table,
{
ag-type
:aggregation-type
}
:aggregation
}
:query,
:as
query
}]
(
qp
(
if
(
or
(
not
(
=
ag-type
:rows
))
breakout
fields
)
query
(
->
query
(
assoc-in
[
:query
:fields-is-implicit
]
true
)
(
assoc-in
[
:query
:fields
]
(
->>
(
sel
:many
[
Field
:name
:base_type
:special_type
:table_id
]
,
:table_id
source-table-id,
:active
true,
:preview_display
true,
:field_type
[
not=
"sensitive"
]
,
(
k/order
:position
:asc
)
,
(
k/order
:id
:desc
))
(
map
expand/rename-mb-field-keys
)
;; TODO - we need to resolve the Tables for these newly added
Field
s (!
)
(
mapv
expand/
map->Field
))
))))))
(
mapv
expand/map->
Field
))
)
(
expand/
resolve-tables
source-table
))))))
(
defn-
pre-add-implicit-breakout-order-by
...
...
@@ -392,7 +392,6 @@
;;
;; Pre-processing then happens in order from bottom-to-top; i.e. POST-ANNOTATE gets to modify the results, then LIMIT, then CUMULATIVE-SUM, etc.
(
defn-
process-structured
[
driver
query
]
(
let
[
driver-process-query
(
partial
i/process-query
driver
)]
((
<<-
wrap-catch-exceptions
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/query_processor/expand.clj
+
7
−
6
View file @
7537c452
...
...
@@ -124,13 +124,14 @@
[{
database-id
:database,
:as
expanded-query-dict
}]
(
assoc
expanded-query-dict
:database
(
sel
:one
:fields
[
Database
:name
:id
:engine
:details
]
:id
database-id
)))
(
defn
-
resolve-tables
(
defn
resolve-tables
"Resolve the `Tables` in an EXPANDED-QUERY-DICT."
[{{
source-table-id
:source-table
}
:query,
database-id
:database,
:as
expanded-query-dict
}]
;; TODO - this doesn't handle join tables yet
(
let
[
table
(
sel
:one
:fields
[
Table
:name
:id
]
:id
source-table-id
)]
(
->>
(
assoc-in
expanded-query-dict
[
:query
:source-table
]
table
)
(
walk/postwalk
#
(
resolve-table
%
{(
:id
table
)
table
})))))
([{{
source-table-id
:source-table
}
:query,
:as
expanded-query-dict
}]
(
resolve-tables
expanded-query-dict
(
sel
:one
:fields
[
Table
:name
:id
]
:id
source-table-id
)))
([
expanded-query-dict
table
]
{
:pre
[(
map?
table
)]}
(
->>
(
assoc-in
expanded-query-dict
[
:query
:source-table
]
table
)
(
walk/postwalk
#
(
resolve-table
%
{(
:id
table
)
table
})))))
;; ## -------------------- Public Interface --------------------
...
...
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