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
a1ba022a
Commit
a1ba022a
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
almost all g2g
parent
357ffdfc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.dir-locals.el
+1
-1
1 addition, 1 deletion
.dir-locals.el
src/metabase/driver/query_processor/annotate.clj
+39
-23
39 additions, 23 deletions
src/metabase/driver/query_processor/annotate.clj
with
40 additions
and
24 deletions
.dir-locals.el
+
1
−
1
View file @
a1ba022a
...
...
@@ -27,7 +27,7 @@
(
expect-with-all-drivers
1
)
(
expect-with-dataset
1
)
(
expect-with-datasets
1
)
(
fpred-conda
2
)
(
fpred-conda
1
)
(
ins
1
)
(
let-400
1
)
(
let-404
1
)
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/query_processor/annotate.clj
+
39
−
23
View file @
a1ba022a
...
...
@@ -128,8 +128,10 @@
(
defn-
special-typeo
[
field
out
]
(
fresh
[
special-type
]
(
featurec
field
{
:special-type
special-type
})
(
==
out
(
or
(
special-type-groups
special-type
)
(
special-type-groups
:other
)))))
(
conda
((
==
special-type
:id
)
(
==
out
(
special-type-groups
:id
)))
((
==
special-type
:name
)
(
==
out
(
special-type-groups
:name
)))
(
s
#
(
==
out
(
special-type-groups
:other
))))))
(
defn-
field-name<
[
query
]
(
fn
[
f1
f2
]
...
...
@@ -142,34 +144,36 @@
((
!=
k
name-2
)
(
when
(
seq
more
)
(
name<
more
)))))
(
:result-keys
query
)))))
(
defn-
fpred<
[
f
field1
field2
]
(
fresh
[
v1
v2
]
(
f
field1
v1
)
(
f
field2
v2
)
(
trace-lvars
"*"
v1
v2
)
(
ar/<
v1
v2
)))
(
defn-
fpredo
[
pred
f
v1
v2
]
"Succeds if `(pred & fresh-values)` succeeds, where fresh values
are obtained with calls to F like `(f value fresh-value)`."
(
fresh
[
fresh-v1
fresh-v2
]
(
f
v1
fresh-v1
)
(
f
v2
fresh-v2
)
#
_
(
trace-lvars
(
str
f
)
fresh-v1
fresh-v2
)
(
pred
fresh-v1
fresh-v2
)))
(
defn-
fpred==
[
f
field1
field2
]
(
fresh
[
v1
v2
]
(
f
field1
v1
)
(
f
field2
v2
)
(
==
v1
v2
)))
(
defn-
ar-<
[
x
y
]
(
ar/<
x
y
))
(
defmacro
^
:private
fpred-conda
[
pred
<-clause
==-
clause
]
(
defmacro
^
:private
fpred-conda
[
[
f
&
values
]
&
clause
s
]
`
(
conda
((
fpred<
~
pred
~
'f1
~
'f2
)
~
<-
clause
)
((
fpred
==
~
pred
~
'f1
~
'f2
)
~
==-clause
)))
~@
(
for
[[
pred
&
body
]
clause
s
]
`
((
fpred
o
~
pred
~
f
~@
values
)
~@
body
)
)))
(
defn-
fields<
[
query
]
(
let
[
groupo
(
field-group
<
query
)
(
let
[
groupo
(
field-group
o
query
)
name<
(
field-name<
query
)]
(
fn
[
f1
f2
]
(
fpred-conda
groupo
s
#
;; TODO - sort by sequential position for fields + breakout
s
#
#
_
(
fpred-conda
positiono
s
#
(
fpred-conda
special-typeo
s
#
(
name<
f1
f2
)))))))
(
fpred-conda
[
groupo
f1
f2
]
(
ar-<
s
#
)
(
==
(
fpred-conda
[
positiono
f1
f2
]
(
ar-<
s
#
)
(
==
(
fpred-conda
[
groupo
f1
f2
]
(
ar-<
s
#
)
; TODO - sort by sequential position for fields + breakout
(
==
(
fpred-conda
[
special-typeo
f1
f2
]
(
ar-<
s
#
)
(
==
(
name<
f1
f2
))))))))))))
(
defn-
sorted-intoo
[
pred
l
v
out
]
(
matche
[
l
]
...
...
@@ -198,6 +202,18 @@
(
everyg
(
fieldo
query
)
fields
)
(
sorted-permutationo
(
fields<
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