dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26674
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13193: Analytics, making partition creation more robust
------------------------------------------------------------
revno: 13193
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-10 15:17:42 +0100
message:
Analytics, making partition creation more robust
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java 2013-11-27 19:02:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java 2013-12-10 14:17:42 +0000
@@ -119,16 +119,19 @@
public List<AnalyticsTable> getTables( Date earliest, Date latest )
{
log.info( "Get tables using earliest: " + earliest + ", latest: " + latest );
-
- String baseName = getTableName();
-
- List<Period> periods = PartitionUtils.getPeriods( earliest, latest );
List<AnalyticsTable> tables = new ArrayList<AnalyticsTable>();
- for ( Period period : periods )
- {
- tables.add( new AnalyticsTable( baseName, getDimensionColumns( null ), period ) );
+ if ( earliest != null && latest != null )
+ {
+ String baseName = getTableName();
+
+ List<Period> periods = PartitionUtils.getPeriods( earliest, latest );
+
+ for ( Period period : periods )
+ {
+ tables.add( new AnalyticsTable( baseName, getDimensionColumns( null ), period ) );
+ }
}
return tables;
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-11-27 19:02:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-12-10 14:17:42 +0000
@@ -245,7 +245,8 @@
public Date getEarliestData()
{
final String sql = "select min(pe.startdate) from datavalue dv " +
- "join period pe on dv.periodid=pe.periodid";
+ "join period pe on dv.periodid=pe.periodid " +
+ "where pe.startdate is not null";
return jdbcTemplate.queryForObject( sql, Date.class );
}
@@ -253,7 +254,8 @@
public Date getLatestData()
{
final String sql = "select max(pe.enddate) from datavalue dv " +
- "join period pe on dv.periodid=pe.periodid";
+ "join period pe on dv.periodid=pe.periodid " +
+ "where pe.enddate is not null ";
return jdbcTemplate.queryForObject( sql, Date.class );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2013-11-27 19:02:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java 2013-12-10 14:17:42 +0000
@@ -177,7 +177,8 @@
public Date getEarliestData()
{
final String sql = "select min(pe.startdate) from completedatasetregistration cdr " +
- "join period pe on cdr.periodid=pe.periodid";
+ "join period pe on cdr.periodid=pe.periodid " +
+ "where pe.startdate is not null";
return jdbcTemplate.queryForObject( sql, Date.class );
}
@@ -185,7 +186,8 @@
public Date getLatestData()
{
final String sql = "select max(pe.enddate) from completedatasetregistration cdr " +
- "join period pe on cdr.periodid=pe.periodid";
+ "join period pe on cdr.periodid=pe.periodid " +
+ "where pe.enddate is not null";
return jdbcTemplate.queryForObject( sql, Date.class );
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-12-05 10:41:52 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java 2013-12-10 14:17:42 +0000
@@ -258,14 +258,16 @@
public Date getEarliestData()
{
- final String sql = "select min(psi.executiondate) from programstageinstance psi;";
+ final String sql = "select min(psi.executiondate) from programstageinstance psi " +
+ "where psi.executiondate is not null";
return jdbcTemplate.queryForObject( sql, Date.class );
}
public Date getLatestData()
{
- final String sql = "select max(psi.executiondate) from programstageinstance psi;";
+ final String sql = "select max(psi.executiondate) from programstageinstance psi " +
+ "where psi.executiondate is not null";
return jdbcTemplate.queryForObject( sql, Date.class );
}