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
3a5c413f
Commit
3a5c413f
authored
9 years ago
by
Cam Saül
Browse files
Options
Downloads
Patches
Plain Diff
parent
45181ea1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.dir-locals.el
+0
-1
0 additions, 1 deletion
.dir-locals.el
src/metabase/driver/query_processor.clj
+0
-1
0 additions, 1 deletion
src/metabase/driver/query_processor.clj
src/metabase/driver/query_processor/annotate.clj
+23
-48
23 additions, 48 deletions
src/metabase/driver/query_processor/annotate.clj
with
23 additions
and
50 deletions
.dir-locals.el
+
0
−
1
View file @
3a5c413f
...
...
@@ -30,7 +30,6 @@
(
expect-with-all-drivers
1
)
(
expect-with-dataset
1
)
(
expect-with-datasets
1
)
(
fpred-conda
1
)
(
ins
1
)
(
let-400
1
)
(
let-404
1
)
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/query_processor.clj
+
0
−
1
View file @
3a5c413f
...
...
@@ -64,7 +64,6 @@
(
=
num-results
max-result-rows
)
(
assoc-in
[
:data
:rows_truncated
]
max-result-rows
)))))
(
defn-
should-add-implicit-fields?
[{{
:keys
[
fields
breakout
]
,
{
ag-type
:aggregation-type
}
:aggregation
}
:query
}]
(
println
"AG-TYPE:"
ag-type
)
(
and
(
or
(
not
ag-type
)
(
=
ag-type
:rows
))
(
not
breakout
)
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/query_processor/annotate.clj
+
23
−
48
View file @
3a5c413f
...
...
@@ -2,6 +2,7 @@
(
:refer-clojure
:exclude
[
==
])
(
:require
[
clojure.core.logic
:refer
:all
]
[
clojure.core.logic.arithmetic
:as
ar
]
[
clojure.tools.macro
:refer
[
macrolet
]]
(
clojure
[
set
:as
set
]
[
string
:as
s
])
[
metabase.db
:refer
[
sel
]]
...
...
@@ -164,66 +165,40 @@
((
groupo
f1
(
field-groups
:breakout
))
(
matches-seq-ordero
f1
f2
breakout-fields
))
((
groupo
f1
(
field-groups
:explicit-fields
))
(
matches-seq-ordero
f1
f2
fields-fields
))))))
;; TODO - inline these ?
(
defn-
f<
[
f
]
(
fn
[
f1
f2
]
(
fresh
[
v1
v2
]
(
f
f1
v1
)
(
f
f2
v2
)
(
ar/<
v1
v2
))))
(
defn-
f==
[
f
]
(
fn
[
f1
f2
]
(
fresh
[
v
]
(
f
f1
v
)
(
f
f2
v
))))
(
defn-
fields-sortedo
[
query
]
(
let
[
groupo
(
field-groupo
query
)
name<
(
field-name<
query
)
clause-pos<
(
clause-position<
query
)]
(
fn
[
f1
f2
]
(
conda
(((
f<
groupo
)
f1
f2
)
s
#
)
(((
f==
groupo
)
f1
f2
)
(
conda
(((
f<
field-positiono
)
f1
f2
)
s
#
)
(((
f==
field-positiono
)
f1
f2
)
(
macrolet
[(
<-or-==
[
f
&
==-clauses
]
`
(
fresh
[
v1
#
v2
#
]
(
~
f
~
'f1
v1
#
)
(
~
f
~
'f2
v2
#
)
(
conda
((
==
v1
#
v2
#
)
~@
==-clauses
)
((
ar/<
v1
#
v2
#
)
~
's#
))))]
(
let
[
groupo
(
field-groupo
query
)
name<
(
field-name<
query
)
clause-pos<
(
clause-position<
query
)]
(
fn
[
f1
f2
]
(
<-or-==
groupo
(
<-or-==
field-positiono
(
conda
((
groupo
f1
(
field-groups
:other
))
(
conda
(((
f<
special-typeo
)
f1
f2
)
s
#
)
(((
f==
special-typeo
)
f1
f2
)
(
name<
f1
f2
))))
((
clause-pos<
f1
f2
))))))))))
((
groupo
f1
(
field-groups
:other
))
(
<-or-==
special-typeo
(
name<
f1
f2
)))
((
clause-pos<
f1
f2
)))))))))
(
defn-
resolve+order-cols
[{
:keys
[
result-keys
]
,
:as
query
}]
{
:pre
[(
seq
result-keys
)]
;; :post [(sequential? %) (every? map? %)]
}
(
println
result-keys
)
:post
[(
sequential?
%
)
(
every?
map?
%
)]}
(
time
(
first
(
let
[
fields
(
vec
(
lvars
(
count
result-keys
)))
known-fieldo
(
fieldo
query
)]
(
run
1
[
q
]
;; Make a new constraint for every lvar FIELDS[i] to give it the name of RESULT-KEYS[i]
(
everyg
(
fn
[
i
]
(
let
[
field
(
fields
i
)
,
field-name
(
result-keys
i
)]
(
everyg
(
fn
[[
result-key
field
]]
(
all
(
field-nameo
field
result-key
)
(
conda
((
all
(
field-nameo
field
field-name
)
(
known-fieldo
field
))
)
((
unknown-fieldo
field-name
field
)))))
(
range
0
(
count
result-keys
)
))
(
(
known-fieldo
field
))
((
unknown-fieldo
result-key
field
)))))
(
zipmap
result-keys
fields
))
(
sorted-permutationo
(
fields-sortedo
query
)
fields
q
))))))
(
defn
x
[]
(
require
'metabase.driver
'metabase.test.data
)
(
@
(
ns-resolve
'metabase.driver
'process-query
)
{
:type
:query,
:database
(
@
(
ns-resolve
'metabase.test.data
'db-id
))
,
:query
{
:source_table
(
@
(
ns-resolve
'metabase.test.data
'id
)
:venues
)
,
:filter
nil,
:aggregation
[
"rows"
]
,
:breakout
[
nil
]
,
:limit
10
,
:order_by
[[(
@
(
ns-resolve
'metabase.test.data
'id
)
:venues
:id
)
"ascending"
]]}}))
;;; # ---------------------------------------- COLUMN DETAILS ----------------------------------------
...
...
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