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
9f5a86b3
Commit
9f5a86b3
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
fix nasty nasty nasty logic error
parent
8e6697e0
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/mongo.clj
+2
-1
2 additions, 1 deletion
src/metabase/driver/mongo.clj
src/metabase/driver/mongo/util.clj
+3
-6
3 additions, 6 deletions
src/metabase/driver/mongo/util.clj
with
5 additions
and
7 deletions
src/metabase/driver/mongo.clj
+
2
−
1
View file @
9f5a86b3
...
...
@@ -90,7 +90,7 @@
{(
name
column-name
)
(
field->base-type
{
:name
(
name
column-name
)
:table
(
delay
table
)
:qualified-name-components
(
delay
[(
name
column-name
)])})}))))
:qualified-name-components
(
delay
[
(
:name
table
)
(
name
column-name
)])})}))))
(
table-pks
[
_
_
]
#
{
"_id"
})
...
...
@@ -106,6 +106,7 @@
"You must have an open Mongo connection in order to get lazy results with field-values-lazy-seq."
)
(
let
[
table
@
table
name-components
(
rest
@
qualified-name-components
)]
(
assert
(
seq
name-components
))
(
map
#
(
get-in
%
(
map
keyword
name-components
))
(
mq/with-collection
*mongo-connection*
(
:name
table
)
(
mq/fields
[(
apply
str
(
interpose
"."
name-components
))]))))))
...
...
This diff is collapsed.
Click to expand it.
src/metabase/driver/mongo/util.clj
+
3
−
6
View file @
9f5a86b3
...
...
@@ -82,7 +82,6 @@
This just gets counts the types of *every* value and returns the `base_type` for class whose count was highest."
[
values-seq
]
{
:pre
[(
sequential?
values-seq
)]}
(
println
(
first
values-seq
))
(
or
(
->>
values-seq
;; TODO - why not do a query to return non-nil values of this column instead
(
filter
identity
)
...
...
@@ -91,14 +90,12 @@
;; nil)
(
take
1000
)
(
group-by
type
)
;; create tuples like [Integer -count]. Make count negative so when we call (sort-by second) in the next step the rows
;; with the highest count will be returned first (e.g. [Integer -100] will be sorted ahead of [Float -20])
(
map
(
fn
[[
klass
valus
]]
(
println
[
klass
(
count
valus
)])
[
klass
(
count
valus
)]))
[
klass
(
-
0
(
count
valus
))]))
(
sort-by
second
)
first
first
((
fn
[
klass
]
(
println
klass
)
klass
))
driver/class->base-type
)
:UnknownField
))
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