Hi Rukshan,

Please find the comments inline.

1. Aggregated functions like avg(), max(), sum() etc gives casting error.
>
> Query:
> from ApiExeTime within 0L, 2591125111000L per 'minutes' select apiName,
> max(responseTime) as time group by apiName
>
> Error:
> "message": "Cannot query: Error executing 'store_select_query_ApiExeTime',
> java.lang.Long cannot be cast to java.lang.Double"
>
> But if we multiply by another number, it is working fine. ex:
> "max(responseTime * 1) as time"
>
>
What is the data type of time ? is it double ? Why cant we change it to
long ? as response times should be long .

>
> 2. Cannot reuse the alias defined in the select
>
> Query:
>
> from ApiExeTime within 0L, 2591125111000L per 'minutes' select apiName,
> max(serviceTime * 1) as service, max(backendTime * 1) as backend , (service
> + backend) as responseTime group by apiName
>
> Here service and backend alias are already defined in the same query. But
> when it tries to reuse it is not found. If we modify the query as below, it
> is working.
>
> (max(serviceTime * 1) + max(backendTime * 1)) as responseTime
>
>
In here even though you mention it in the select statement as "
max(serviceTime * 1) as service, max(backendTime * 1) as backend " you
cannot use those aliases to computation within same query. I think this
should be the correct behaviour IMO. Normally when you write a siddhi query
and after you introduce aliases if you want to use them you need to put it
to a nother stream and then use that stream. But this does not break any
functionality.

Regards,
Damith

On Thu, Jun 11, 2020 at 2:36 PM Rukshan Premathunga <ruks...@wso2.com>
wrote:

> Hi All,
>
> Noticed following issue in siddhi
>
> 1. Aggregated functions like avg(), max(), sum() etc gives casting error.
>
> Query:
> from ApiExeTime within 0L, 2591125111000L per 'minutes' select apiName,
> max(responseTime) as time group by apiName
>
> Error:
> "message": "Cannot query: Error executing 'store_select_query_ApiExeTime',
> java.lang.Long cannot be cast to java.lang.Double"
>
> But if we multiply by another number, it is working fine. ex:
> "max(responseTime * 1) as time"
>
>
> 2. Cannot reuse the alias defined in the select
>
> Query:
>
> from ApiExeTime within 0L, 2591125111000L per 'minutes' select apiName,
> max(serviceTime * 1) as service, max(backendTime * 1) as backend , (service
> + backend) as responseTime group by apiName
>
> Here service and backend alias are already defined in the same query. But
> when it tries to reuse it is not found. If we modify the query as below, it
> is working.
>
> (max(serviceTime * 1) + max(backendTime * 1)) as responseTime
>
> But it looks like we do the same computation again and not use the already
> computed value.
>
>
> It looks like this is an issue with siddhi. Is this fixed in the latest
> versions or can we fix this?
>
> Thanks and Regards
> --
> Rukshan C. Premathunga | Associate Technical Lead | WSO2 Inc.
> (m) +94711822074 | (w) +94112145345 | Email: ruks...@wso2.com
> GET INTEGRATION AGILE
> Integration Agility for Digitally Driven Business
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
Associate Technical Lead | WSO2 Inc.
lean.enterprise.middleware

mobile: *+94728671315*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to