DC
Size: a a a
DC
v
DC
select toStartOfHour(param_date) as hour,
any((JSONExtractKeysAndValues(param, 'a_zone_temperature', 'Float32'))) as a_zone_temperature
from telemetry_common
where param_date > today()
and src_id = 125
group by hour
order by hour desc;
2020-08-13 14:00:00,"[('3',100),('4',103),('100',102),('0',98),('1',81),('2',95)]"
2020-08-13 13:00:00,"[('3',102),('4',80),('100',86),('0',109),('1',99),('2',101)]"
2020-08-13 12:00:00,"[('3',91),('4',83),('100',80),('0',101),('1',86),('2',83)]"
2020-08-13 11:00:00,"[('3',110),('4',98),('100',101),('0',110),('1',96),('2',84)]"
2020-08-13 10:00:00,"[('3',96),('4',80),('100',100),('0',110),('1',87),('2',107)]"
2020-08-13 09:00:00,"[('3',92),('4',105),('100',96),('0',83),('1',108),('2',93)]"
2020-08-13 08:00:00,"[('3',108),('4',95),('100',98),('0',93),('1',87),('2',82)]"
DC
S
select toStartOfHour(param_date) as hour,
any((JSONExtractKeysAndValues(param, 'a_zone_temperature', 'Float32'))) as a_zone_temperature
from telemetry_common
where param_date > today()
and src_id = 125
group by hour
order by hour desc;
2020-08-13 14:00:00,"[('3',100),('4',103),('100',102),('0',98),('1',81),('2',95)]"
2020-08-13 13:00:00,"[('3',102),('4',80),('100',86),('0',109),('1',99),('2',101)]"
2020-08-13 12:00:00,"[('3',91),('4',83),('100',80),('0',101),('1',86),('2',83)]"
2020-08-13 11:00:00,"[('3',110),('4',98),('100',101),('0',110),('1',96),('2',84)]"
2020-08-13 10:00:00,"[('3',96),('4',80),('100',100),('0',110),('1',87),('2',107)]"
2020-08-13 09:00:00,"[('3',92),('4',105),('100',96),('0',83),('1',108),('2',93)]"
2020-08-13 08:00:00,"[('3',108),('4',95),('100',98),('0',93),('1',87),('2',82)]"
SELECT
hour,
a_zone_temperature.1 AS category,
avg(a_zone_temperature.2) AS avg_temp
FROM (
select toStartOfHour(param_date) as hour,
any((JSONExtractKeysAndValues(param, 'a_zone_temperature', 'Float32'))) as a_zone_temperature
from telemetry_common
where param_date > today()
and src_id = 125
group by hour
order by hour desc
)
GROUP BY hour, category;
DC
VP
('avg', a_zone_temperature)
не может примениться к туплам...VP
select toStartOfHour(param_date) as hour,
groupArray((JSONExtractKeysAndValues(param, 'a_zone_temperature', 'Float32'))) as a_zone_temperature,
arrayReduce('avg', a_zone_temperature)
from telemetry_common
where param_date > today()
and src_id = 125
group by hour
order by hour desc;
OM
A
A
D
II
D
II
D
A
КТ
A