Skip to content

Commit

Permalink
fix: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
larshelge committed Nov 26, 2024
1 parent 098c071 commit a64424f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ protected void populateTableInternal(AnalyticsTablePartition partition, String f
}

/**
* The select statement used by the table population.
* The select subquery statement.
*
* @param attribute the {@link TrackedEntityAttribute}.
* @param columnExpression the column expression.
* @param dataClause the data type related clause like "NUMERIC".
* @return a select statement.
*/
protected String selectForInsert(
protected String getSelectSubquery(
TrackedEntityAttribute attribute, String columnExpression, String dataClause) {
return replaceQualify(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private List<AnalyticsTableColumn> getTrackedEntityAttributeColumns(Program prog

if (attribute.getValueType().isOrganisationUnit()) {
String fromTypeSql = "ou.name from organisationunit ou where ou.uid = (select value";
String ouNameSql = selectForInsert(attribute, fromTypeSql, dataClause);
String ouNameSql = getSelectSubquery(attribute, fromTypeSql, dataClause);

columns.add(
AnalyticsTableColumn.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ private List<AnalyticsTableColumn> getColumnForAttribute(TrackedEntityAttribute
DataType dataType = getColumnType(attribute.getValueType(), isSpatialSupport());
String selectExpression = getSelectExpressionForAttribute(attribute.getValueType(), "value");
String dataExpression = getDataFilterClause(attribute);
String sql = selectForInsert(attribute, selectExpression, dataExpression);
String sql = getSelectSubquery(attribute, selectExpression, dataExpression);
Skip skipIndex = skipIndex(attribute.getValueType(), attribute.hasOptionSet());

if (attribute.getValueType().isOrganisationUnit()) {
Expand Down Expand Up @@ -674,7 +674,7 @@ private List<AnalyticsTableColumn> getColumnsForOrgUnitTrackedEntityAttribute(

if (isSpatialSupport()) {
String fromType = "ou.geometry " + fromClause;
String geoSql = selectForInsert(attribute, fromType, dataFilterClause);
String geoSql = getSelectSubquery(attribute, fromType, dataFilterClause);
columns.add(
AnalyticsTableColumn.builder()
.name((attribute.getUid() + OU_GEOMETRY_COL_SUFFIX))
Expand All @@ -686,7 +686,7 @@ private List<AnalyticsTableColumn> getColumnsForOrgUnitTrackedEntityAttribute(
}

String fromTypeSql = "ou.name " + fromClause;
String ouNameSql = selectForInsert(attribute, fromTypeSql, dataFilterClause);
String ouNameSql = getSelectSubquery(attribute, fromTypeSql, dataFilterClause);

columns.add(
AnalyticsTableColumn.builder()
Expand Down

0 comments on commit a64424f

Please sign in to comment.