Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
a47462c2
Commit
a47462c2
authored
Aug 19, 2019
by
Anne Blankert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allways include nulls in values array
parent
73533621
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
column_stats.js
column_stats.js
+13
-5
No files found.
column_stats.js
View file @
a47462c2
const
sqlTableName
=
require
(
'./utils/sqltablename.js'
);
// get top 100 most frequent values and null values
const
sql
=
(
params
,
query
)
=>
{
return
`
select count(1)::integer as "count", "
${
params
.
column
}
" as "value"
from
${
sqlTableName
(
params
.
table
)}
where
${
query
.
geom_column
}
is not null
group by "
${
params
.
column
}
" order by count(1) desc limit 100;
`
with sortedrecords as
(select count(1)::integer as "count", "
${
params
.
column
}
" as "value"
from
${
sqlTableName
(
params
.
table
)}
where
${
query
.
geom_column
}
is not null
group by "
${
params
.
column
}
" order by count(1) desc)
,toprecords as
(select * from sortedrecords limit 100)
,resultset as
(select * from toprecords
union
select * from sortedrecords where value is null)
select distinct * from resultset order by count desc;`
}
// TODO, use sql place holders $1, $2 etc. instead of inserting user-parameters into query
// https://leafo.net/guides/postgresql-calculating-percentile.html
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment