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

3.3.2.0 Community聚合运算出问题 #27662

Open
YukiYlf opened this issue Sep 4, 2024 · 3 comments
Open

3.3.2.0 Community聚合运算出问题 #27662

YukiYlf opened this issue Sep 4, 2024 · 3 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@YukiYlf
Copy link

YukiYlf commented Sep 4, 2024

select
time ,
min(cast(pressure as float)) as min_pr,
num
from iot.device_property_20015 where time >= '2024-08-30' and time < '2024-09-04'
partition by num interval(10m) FILL(none)
limit 100

正确的

改成
select
time ,
min(cast(pressure as float)) as min_pr,
max(cast(pressure as float)) as max_pr,
num
from iot.device_property_20015 where time >= '2024-08-30' and time < '2024-09-04'
partition by num interval(10m) FILL(none)
limit 100
错误:
] 错误: Internal error: Invalid usage of expr: time 全部: 19ms

@YukiYlf YukiYlf added help wanted Extra attention is needed question Further information is requested labels Sep 4, 2024
@YukiYlf
Copy link
Author

YukiYlf commented Sep 4, 2024

select time , min(cast(pressure as float)) as min_pr, min(cast(pressure as float)) as min_pr1, num from iot.device_property_20015 where time >= '2024-08-30' and time < '2024-09-04' partition by num interval(10m) FILL(none) limit 100
错误: Internal error: Invalid usage of expr: time 全部: 19ms

奇怪是,只能做一个,比如最大,或者最小,或者平均

@YukiYlf
Copy link
Author

YukiYlf commented Sep 4, 2024

image

pressure 这个字段本身是nchar , 转换float数
我也尝试写
image

@Simon9997
Copy link
Contributor

首先,min/max 这种函数根据官网的定义来说是选择函数,参见。如果你把 min/max 换成定义上的聚合函数比如 count 时,无论有几个函数都会报错。
其次,当只有一个选择函数时,select list 中的 time 是被当作选择函数返回的列处理的,也就是说这里 select 的 time 是对应着 min(pressure) 那一行的 time,所以此时不会报错。
当有两个选择函数时,time 就无法被当作是选择函数返回的列,这时候使用的规则是 group by 对于 select list 的约束,参见,因为 time 列没有出现在 group by 子句中,所以会报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants