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
0d25c1b7
Unverified
Commit
0d25c1b7
authored
7 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Plain Diff
Merge branch 'fingerprints-poc' of github.com:metabase/metabase into fingerprints-poc
parents
e6ab463f
7e3fc9f9
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
src/metabase/fingerprinting/fingerprinters.clj
+43
-39
43 additions, 39 deletions
src/metabase/fingerprinting/fingerprinters.clj
with
43 additions
and
39 deletions
src/metabase/fingerprinting/fingerprinters.clj
+
43
−
39
View file @
0d25c1b7
...
...
@@ -279,11 +279,13 @@
:skewness
:entropy
:nil%
:uniqueness
:range
:min-vs-max
]))
(
defmethod
x-ray
Num
[{
:keys
[
field
]
:as
fingerprint
}]
(
->
fingerprint
(
update
:histogram
(
partial
histogram->dataset
field
))
(
dissoc
:has-nils?
:var>sd?
:0<=x<=1?
:-1<=x<=1?
:all-distinct?
:positive-definite?
:var>sd?
:uniqueness
:min-vs-max
)))
[{
:keys
[
field
count
]
:as
fingerprint
}]
(
if
(
pos?
count
)
(
->
fingerprint
(
update
:histogram
(
partial
histogram->dataset
field
))
(
dissoc
:has-nils?
:var>sd?
:0<=x<=1?
:-1<=x<=1?
:all-distinct?
:positive-definite?
:var>sd?
:uniqueness
:min-vs-max
))
fingerprint
))
(
defmethod
fingerprinter
[
Num
Num
]
[
_
field
]
...
...
@@ -472,40 +474,42 @@
[
k
(
*
v
(
/
baseline
(
weights
k
)))])))))
(
defmethod
x-ray
DateTime
[{
:keys
[
field
earliest
latest
]
:as
fingerprint
}]
(
let
[
earliest
(
from-double
earliest
)
latest
(
from-double
latest
)]
(
->
fingerprint
(
assoc
:earliest
earliest
)
(
assoc
:latest
latest
)
(
update
:histogram
(
partial
histogram->dataset
from-double
field
))
(
update
:percentiles
(
partial
m/map-vals
from-double
))
(
update
:histogram-hour
(
partial
histogram->dataset
{
:name
"HOUR"
:display_name
"Hour of day"
:base_type
:type/Integer
:special_type
:type/Category
}))
(
update
:histogram-day
(
partial
histogram->dataset
{
:name
"DAY"
:display_name
"Day of week"
:base_type
:type/Integer
:special_type
:type/Category
}))
(
update
:histogram-month
(
comp
(
partial
weigh-periodicity
(
month-frequencies
earliest
latest
))
(
partial
histogram->dataset
{
:name
"MONTH"
:display_name
"Month of year"
:base_type
:type/Integer
:special_type
:type/Category
})))
(
update
:histogram-quarter
(
comp
(
partial
weigh-periodicity
(
quarter-frequencies
earliest
latest
))
(
partial
histogram->dataset
{
:name
"QUARTER"
:display_name
"Quarter of year"
:base_type
:type/Integer
:special_type
:type/Category
}))))))
[{
:keys
[
field
earliest
latest
count
]
:as
fingerprint
}]
(
if
(
pos?
count
)
(
let
[
earliest
(
from-double
earliest
)
latest
(
from-double
latest
)]
(
->
fingerprint
(
assoc
:earliest
earliest
)
(
assoc
:latest
latest
)
(
update
:histogram
(
partial
histogram->dataset
from-double
field
))
(
update
:percentiles
(
partial
m/map-vals
from-double
))
(
update
:histogram-hour
(
partial
histogram->dataset
{
:name
"HOUR"
:display_name
"Hour of day"
:base_type
:type/Integer
:special_type
:type/Category
}))
(
update
:histogram-day
(
partial
histogram->dataset
{
:name
"DAY"
:display_name
"Day of week"
:base_type
:type/Integer
:special_type
:type/Category
}))
(
update
:histogram-month
(
comp
(
partial
weigh-periodicity
(
month-frequencies
earliest
latest
))
(
partial
histogram->dataset
{
:name
"MONTH"
:display_name
"Month of year"
:base_type
:type/Integer
:special_type
:type/Category
})))
(
update
:histogram-quarter
(
comp
(
partial
weigh-periodicity
(
quarter-frequencies
earliest
latest
))
(
partial
histogram->dataset
{
:name
"QUARTER"
:display_name
"Quarter of year"
:base_type
:type/Integer
:special_type
:type/Category
})))))
(
select-keys
fingerprint
[
:count
:type
:field
])))
(
defmethod
fingerprinter
Category
[
_
field
]
...
...
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