Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
portal-backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
portal-backend
Commits
9139d122
Commit
9139d122
authored
7 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
check if dataset is empty before sampling
parent
cc1d542a
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/main/java/eu/hbp/mip/utils/DataUtil.java
+9
-6
9 additions, 6 deletions
src/main/java/eu/hbp/mip/utils/DataUtil.java
with
9 additions
and
6 deletions
src/main/java/eu/hbp/mip/utils/DataUtil.java
+
9
−
6
View file @
9139d122
...
...
@@ -32,7 +32,12 @@ public class DataUtil {
for
(
String
var
:
vars
)
{
JsonArray
currentVarData
=
new
JsonArray
();
int
samplingPercentage
=
100
*
NB_ROWS_SAMPLING
/
(
int
)
countAdniRows
();
int
nbRows
=
(
int
)
countDatasetRows
();
if
(
nbRows
<
1
)
{
return
data
;
}
int
samplingPercentage
=
100
*
NB_ROWS_SAMPLING
/
nbRows
;
List
<
Object
>
queryResult
=
jdbcTemplate
.
queryForList
(
"SELECT "
+
var
+
" FROM "
+
scienceMainTable
+
" "
+
"TABLESAMPLE SYSTEM ("
+
samplingPercentage
+
") REPEATABLE ( "
+
TABLESAMPLE_SEED
+
" )"
,
Object
.
class
);
...
...
@@ -55,18 +60,16 @@ public class DataUtil {
@Cacheable
(
"colscount"
)
public
long
countVariables
()
{
long
count
=
jdbcTemplate
.
queryForObject
(
return
jdbcTemplate
.
queryForObject
(
"SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS "
+
"WHERE table_name = '"
+
scienceMainTable
+
"'"
,
Long
.
class
);
return
count
;
}
@Cacheable
(
"rowscount"
)
public
long
count
Adni
Rows
()
public
long
count
Dataset
Rows
()
{
long
count
=
jdbcTemplate
.
queryForObject
(
return
jdbcTemplate
.
queryForObject
(
"SELECT COUNT(*) FROM "
+
scienceMainTable
,
Long
.
class
);
return
count
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
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