Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] fix: Analytics tables for ClickHouse [DHIS2-18417] #19445

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
5fdf098
fix: Update code
larshelge Nov 25, 2024
12f1f27
fix: Update code
larshelge Nov 25, 2024
6647eac
fix: Update code
larshelge Nov 25, 2024
50825c4
fix: Update code
larshelge Nov 25, 2024
719655c
fix: Update code
larshelge Nov 25, 2024
c5863b1
fix: Update code
larshelge Nov 25, 2024
d2095b9
fix: Update code
larshelge Nov 25, 2024
18b9782
fix: Update code
larshelge Nov 25, 2024
d1520e3
fix: Update code
larshelge Nov 25, 2024
6c0b5a6
fix: Update code
larshelge Nov 25, 2024
7d42bb0
fix: Update code
larshelge Nov 25, 2024
1ebed16
Merge branch 'master' into DHIS2-18417
larshelge Nov 25, 2024
cb3d523
fix: Update code
larshelge Nov 26, 2024
9f369e4
fix: Update code
larshelge Nov 26, 2024
acccd5d
fix: Update code
larshelge Nov 26, 2024
97b6697
fix: Update code
larshelge Nov 26, 2024
7c725c7
fix: Update code
larshelge Nov 26, 2024
e58f104
Merge branch 'master' into DHIS2-18417
larshelge Nov 26, 2024
e8e862a
Merge branch 'master' into DHIS2-18417
larshelge Nov 26, 2024
490ea09
fix: Update code
larshelge Nov 26, 2024
781d2e4
fix: Update code
larshelge Nov 26, 2024
c1b20d7
fix: Update code
larshelge Nov 26, 2024
c51fb14
fix: Update code
larshelge Nov 26, 2024
a84ff58
fix: Update code
larshelge Nov 26, 2024
e375211
fix: Update code
larshelge Nov 26, 2024
ccbc1e4
Merge branch 'master' into DHIS2-18417
larshelge Nov 26, 2024
43ff102
fix: Update code
larshelge Nov 26, 2024
2cab8fc
fix: Update code
larshelge Nov 26, 2024
adc1599
fix: Update code
larshelge Nov 26, 2024
d013060
Merge branch 'master' into DHIS2-18417
larshelge Nov 26, 2024
793b9fa
fix: Update code
larshelge Nov 26, 2024
105b514
fix: Update code
larshelge Nov 26, 2024
45d734e
fix: Update code
larshelge Nov 26, 2024
793a55b
fix: Update code
larshelge Nov 26, 2024
0640b81
fix: Update code
larshelge Nov 26, 2024
f33bd88
fix: Update code
larshelge Nov 26, 2024
3a6b574
fix: Update code
larshelge Nov 26, 2024
7ac31de
fix: Update code
larshelge Nov 26, 2024
cd9c2ed
fix: Update code
larshelge Nov 26, 2024
e4c070d
fix: Update code
larshelge Nov 26, 2024
9cf4321
fix: Update code
larshelge Nov 26, 2024
df69357
fix: Update code
larshelge Nov 26, 2024
007fabb
fix: Update code
larshelge Nov 29, 2024
8af5d48
Revert "fix: Update code"
larshelge Nov 29, 2024
62627f0
Merge branch 'master' into DHIS2-18417
larshelge Nov 29, 2024
b3b0391
Merge branch 'master' into DHIS2-18417
larshelge Nov 29, 2024
77f814b
Merge branch 'master' into DHIS2-18417
larshelge Nov 30, 2024
4038b0d
fix: Update code
larshelge Nov 30, 2024
b48b83c
fix: Update code
larshelge Dec 1, 2024
f9ed2a3
fix: Update code
larshelge Dec 1, 2024
9a3afb8
fix: Update code
larshelge Dec 1, 2024
92be248
fix: Update code
larshelge Dec 1, 2024
8186edc
fix: Update code
larshelge Dec 1, 2024
31524ca
fix: Update code
larshelge Dec 1, 2024
04965f3
Merge branch 'master' into DHIS2-18417
larshelge Dec 2, 2024
4742e3b
fix: Update code
larshelge Dec 2, 2024
4259834
fix: Update code
larshelge Dec 2, 2024
25f4feb
fix: Update code
larshelge Dec 2, 2024
df215ec
fix: Update code
larshelge Dec 2, 2024
83b4758
fix: Update code
larshelge Dec 2, 2024
7a481d6
fix: Update code
larshelge Dec 2, 2024
bca8df5
fix: Update code
larshelge Dec 2, 2024
fdc5578
fix: Update code
larshelge Dec 2, 2024
13fbc75
fix: Update code
larshelge Dec 3, 2024
50da70c
Merge branch 'master' into DHIS2-18417
larshelge Dec 3, 2024
6633861
Revert "feat: skipAnalytics and ConfidentialFlag only for QUERY Analy…
larshelge Dec 4, 2024
693ac89
fix: Update code
larshelge Dec 4, 2024
b1e7bb3
Merge branch 'master' into DHIS2-18417
larshelge Dec 4, 2024
7b310eb
fix: Update code
larshelge Dec 4, 2024
be271e6
fix: Update code
larshelge Dec 4, 2024
e178384
fix: Update code
larshelge Dec 4, 2024
d3c1957
fix: Update code
larshelge Dec 4, 2024
55d8a84
fix: Update code
larshelge Dec 4, 2024
86ef201
fix: Update code
larshelge Dec 4, 2024
f4e7684
fix: Update code
larshelge Dec 4, 2024
a032072
fix: Update code
larshelge Dec 4, 2024
87a0fd3
fix: Update code
larshelge Dec 4, 2024
c93f4ff
fix: Update code
larshelge Dec 4, 2024
8d9b40f
fix: Update code
larshelge Dec 4, 2024
00536ff
fix: Update code
larshelge Dec 4, 2024
15cb92a
fix: Update code
larshelge Dec 4, 2024
85c2c92
fix: Update code
larshelge Dec 4, 2024
cd2cb15
Merge branch 'master' into DHIS2-18417
larshelge Dec 4, 2024
bec3c7e
fix: Update code
larshelge Dec 4, 2024
f66b2be
fix: Update code
larshelge Dec 4, 2024
7b92571
fix: Update code
larshelge Dec 4, 2024
b400d6b
fix: Update code
larshelge Dec 4, 2024
f55b900
fix: Update code
larshelge Dec 4, 2024
fb8c59f
fix: Update code
larshelge Dec 4, 2024
b4f34ba
fix: Update code
larshelge Dec 4, 2024
50d99c6
Merge branch 'master' into DHIS2-18417
larshelge Dec 4, 2024
ddb1161
fix: Update code
larshelge Dec 4, 2024
251e246
fix: Update code
larshelge Dec 4, 2024
d6c9f0e
fix: Update code
larshelge Dec 4, 2024
4bd41ca
fix: Update code
larshelge Dec 4, 2024
427ffbb
fix: Update code
larshelge Dec 4, 2024
b0f0751
fix: Update code
larshelge Dec 4, 2024
cce6d85
fix: Update code
larshelge Dec 4, 2024
63484bd
fix: Update code
larshelge Dec 4, 2024
c083771
Merge branch 'master' into DHIS2-18417
larshelge Dec 4, 2024
1064844
fix: Update code
larshelge Dec 4, 2024
67ef7db
fix: Update code
larshelge Dec 4, 2024
a4084c5
fix: Update code
larshelge Dec 4, 2024
1ed29a4
fix: Update code
larshelge Dec 4, 2024
ee94d65
fix: Update code
larshelge Dec 4, 2024
7918f3f
fix: Update code
larshelge Dec 4, 2024
000cc5d
fix: Update code
larshelge Dec 4, 2024
8caf620
fix: Update code
larshelge Dec 4, 2024
aeca0bd
fix: Update code
larshelge Dec 4, 2024
e0f0b7e
Merge branch 'master' into DHIS2-18417
larshelge Dec 5, 2024
75f1e63
fix: Update code
larshelge Dec 5, 2024
c3597a6
fix: Update strings
larshelge Dec 6, 2024
bec56ad
fix: Update code
larshelge Dec 10, 2024
c4b6775
fix: Update code
larshelge Dec 10, 2024
92aaf49
Merge branch 'master' into DHIS2-18417
larshelge Dec 10, 2024
4be3059
Merge branch 'master' into DHIS2-18417
larshelge Dec 10, 2024
2bec9de
fix: Update code
larshelge Dec 10, 2024
b76b930
fix: Update code
larshelge Dec 10, 2024
70fbb1f
fix: Update code
larshelge Dec 10, 2024
9c4143c
fix: Update code
larshelge Dec 10, 2024
8747d39
fix: Update code
larshelge Dec 10, 2024
311bb4f
fix: Update code
larshelge Dec 10, 2024
62eb664
fix: Update code
larshelge Dec 10, 2024
6a4c3b1
fix: Update code
larshelge Dec 10, 2024
f51f4c3
fix: Update code
larshelge Dec 10, 2024
7f9e59d
fix: Update code
larshelge Dec 10, 2024
fd72ecc
fix: Update code
larshelge Dec 10, 2024
c92d33f
Merge branch 'master' into DHIS2-18417
larshelge Dec 10, 2024
a0257a3
fix: Update code
larshelge Dec 11, 2024
5ef9f34
fix: Update code
larshelge Dec 11, 2024
536a950
fix: Update code
larshelge Dec 11, 2024
dcc9206
fix: Update code
larshelge Dec 11, 2024
9f61495
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
394f2ba
fix: Update code
larshelge Dec 11, 2024
324f8e9
fix: Update code
larshelge Dec 11, 2024
c9ca1f2
fix: Update code
larshelge Dec 11, 2024
9ee1cb6
fix: Update code
larshelge Dec 11, 2024
39c08cf
fix: Update code
larshelge Dec 11, 2024
318e862
fix: Update code
larshelge Dec 11, 2024
0cfacb1
fix: Update code
larshelge Dec 11, 2024
3d02bc6
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
718d1be
fix: Update code
larshelge Dec 11, 2024
c679653
fix: Update code
larshelge Dec 11, 2024
e0aa6fb
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
221a551
fix: Update code
larshelge Dec 11, 2024
7b0af20
fix: Update code
larshelge Dec 11, 2024
51462ef
fix: Update code
larshelge Dec 11, 2024
31ca1c6
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
d9a17a3
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
0b838bf
fix: Update code
larshelge Dec 11, 2024
7074bfd
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
96afbba
fix: Update code
larshelge Dec 11, 2024
41bf58e
fix: Update code
larshelge Dec 11, 2024
be3a56b
Merge branch 'master' into DHIS2-18417
larshelge Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ protected List<AnalyticsTableColumn> getColumnForAttribute(TrackedEntityAttribut
*/
private List<AnalyticsTableColumn> getColumnForOrgUnitAttribute(
TrackedEntityAttribute attribute) {
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

Validate.isTrue(attribute.getValueType().isOrganisationUnit());
List<AnalyticsTableColumn> columns = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ private String getSelectExpression(DataElement dataElement, String columnExpress
* @return a list of {@link AnalyticsTableColumn}.
*/
private List<AnalyticsTableColumn> getColumnForOrgUnitDataElement(DataElement dataElement) {
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

List<AnalyticsTableColumn> columns = new ArrayList<>();

if (isSpatialSupport()) {
Expand Down Expand Up @@ -612,6 +616,10 @@ private List<AnalyticsTableColumn> getAttributeColumns(Program program) {
*/
private List<AnalyticsTableColumn> getColumnForAttributeWithLegendSet(
TrackedEntityAttribute attribute) {
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

String columnExpression = getColumnExpression(attribute.getValueType(), "value");
String numericClause = getNumericClause("value");
String query =
Expand Down Expand Up @@ -656,6 +664,10 @@ private List<AnalyticsTableColumn> getColumnForAttributeWithLegendSet(
*/
private List<AnalyticsTableColumn> getColumnFromDataElementWithLegendSet(
DataElement dataElement, String selectExpression, String dataFilterClause) {
if (!sqlBuilder.supportsCorrelatedSubquery()) {
return List.of();
}

String query =
"""
(select l.uid from ${maplegend} l \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private List<AnalyticsTableColumn> getColumns(
List<AnalyticsTableColumn> columns = new ArrayList<>(getFixedColumns());
List<Program> programs = programsByTetUid.get(trackedEntityType.getUid());

if (isNotEmpty(programs)) {
if (isNotEmpty(programs) && sqlBuilder.supportsCorrelatedSubquery()) {
String enrolledInProgramExpression =
"""
\s exists(select 1 from ${enrollment} en_0 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
package org.hisp.dhis.db.init;

import static org.hisp.dhis.db.sql.ClickHouseSqlBuilder.NAMED_COLLECTION;

import java.util.Map;
import javax.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hisp.dhis.db.SqlBuilderProvider;
import org.hisp.dhis.db.model.Database;
import org.hisp.dhis.db.setting.SqlBuilderSettings;
Expand All @@ -43,6 +40,8 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
* Class responsible for performing work for initialization of an analytics database.
Expand Down
Loading