Is it possible to simultaneously use the constant time series generating functions and group by
function at the same time in Apache IoTDB? I understand that group by
and individual fields cannot be used at the same time in the query statment, but can the constant column generation function be used with group by
at the same time? Currently I tried to write query statment like select avg(cast(val, 'type'='double')) as val, const(val, 'value'='test', 'type'='text') as c from root.db1 group by ([2024-02-01T00:00:00,2024-02-20T00:00:00),1h)
, but there is an error message: 701: Raw data and aggregation hybrid query is not supported
. How can I use these two functions at the same time?
In Apache IoTDB, you CAN use const
function and group by
function in one query statement. For your error, you can try to change your query statement to using FIRST_VALUE
to solve the problem, for example select avg(cast(val,'type'='DOUBLE'))as val,FIRST_VALUE(const(val, 'value'='test', 'type'='TEXT')) as c from root.db1 group by ([2024-02-01T00:00:00,2024-02-20T00:00:00),1h)
.