Skip to content

Commit 808faa1

Browse files
committed
Fix SqlSinkTest
1 parent ceb83fa commit 808faa1

File tree

3 files changed

+59
-11
lines changed

3 files changed

+59
-11
lines changed

src/test/resources/edu/ie3/datamodel/io/sink/_sql/load_profile.sql

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
CREATE TABLE public.load_profiles
2+
(
3+
load_profile VARCHAR(11) NOT NULL,
4+
quarter_hour integer NOT NULL,
5+
su_sa DOUBLE PRECISION NOT NULL,
6+
su_su DOUBLE PRECISION NOT NULL,
7+
su_wd DOUBLE PRECISION NOT NULL,
8+
tr_sa DOUBLE PRECISION NOT NULL,
9+
tr_su DOUBLE PRECISION NOT NULL,
10+
tr_wd DOUBLE PRECISION NOT NULL,
11+
wi_sa DOUBLE PRECISION NOT NULL,
12+
wi_su DOUBLE PRECISION NOT NULL,
13+
wi_wd DOUBLE PRECISION NOT NULL,
14+
grid_uuid UUID NOT NULL REFERENCES grids(uuid)
15+
)
16+
WITHOUT OIDS
17+
TABLESPACE pg_default;
18+
19+
CREATE INDEX load_profiles_series_id ON load_profiles USING hash (load_profile);
20+
21+
-- Order of columns is important when using btree: https://www.postgresql.org/docs/14/indexes-multicolumn.html
22+
-- Column time_series needs to placed as the first argument since we at most use an equality constraint on
23+
-- time_series and a range query on time.
24+
CREATE UNIQUE INDEX load_profiles_series_time ON load_profiles USING btree (load_profile, quarter_hour);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CREATE TABLE public.load_profiles
2+
(
3+
load_profile VARCHAR(11) NOT NULL,
4+
quarter_hour integer NOT NULL,
5+
su_sa DOUBLE PRECISION NOT NULL,
6+
su_su DOUBLE PRECISION NOT NULL,
7+
su_wd DOUBLE PRECISION NOT NULL,
8+
tr_sa DOUBLE PRECISION NOT NULL,
9+
tr_su DOUBLE PRECISION NOT NULL,
10+
tr_wd DOUBLE PRECISION NOT NULL,
11+
wi_sa DOUBLE PRECISION NOT NULL,
12+
wi_su DOUBLE PRECISION NOT NULL,
13+
wi_wd DOUBLE PRECISION NOT NULL
14+
)
15+
WITHOUT OIDS
16+
TABLESPACE pg_default;
17+
18+
CREATE INDEX load_profiles_series_id ON load_profiles USING hash (load_profile);
19+
20+
-- Order of columns is important when using btree: https://www.postgresql.org/docs/14/indexes-multicolumn.html
21+
-- Column time_series needs to placed as the first argument since we at most use an equality constraint on
22+
-- time_series and a range query on time.
23+
CREATE UNIQUE INDEX load_profiles_series_time ON load_profiles USING btree (load_profile, quarter_hour);
24+
25+
INSERT INTO
26+
public.load_profiles (load_profile, quarter_hour, su_sa, su_su, su_wd, tr_sa, tr_su, tr_wd, wi_sa, wi_su, wi_wd)
27+
VALUES
28+
29+
('g2', 0, 63.1, 50.6, 60.8, 73.1, 64.2, 70.5, 80.6, 73.7, 77.4),
30+
('g2', 1, 58.0, 47.4, 53.0, 67.6, 60.7, 61.9, 74.6, 68.7, 67.4),
31+
('g2', 2, 53.5, 44.3, 46.0, 62.8, 56.9, 54.4, 69.2, 63.6, 58.4),
32+
33+
('g3', 0, 99.0, 94.6, 98.5, 92.5, 87.6, 91.2, 95.3, 87.8, 94.7),
34+
('g3', 1, 100.0, 95.3, 99.0, 93.0, 87.3, 90.2, 95.5, 88.3, 94.1),
35+
('g3', 2, 100.9, 96.0, 99.4, 93.7, 87.4, 89.4, 96.2, 89.0, 94.1);

0 commit comments

Comments
 (0)