Hi Damith, Sorry for the late reply. On Thu, Jun 11, 2020 at 3:42 PM Damith Wickramasinghe <[email protected]> wrote:
> 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 . > Yes, we use long for these values. But with aggregate functions, looks it try to convert to Double assuming all the values are double. So int and long values have this issue. > >> 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. > Yes, one workaround is to define another stream and use new alias there. So in siddhi, that's looks fine. We actually face this issue in Store REST API. So either we have to change the siddhi apps or change the REST API query. But this will be a limitation for the end users and customer dashboard developers to provide dynamic queries. > > Regards, > Damith > > On Thu, Jun 11, 2020 at 2:36 PM Rukshan Premathunga <[email protected]> > 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: [email protected] >> GET INTEGRATION AGILE >> Integration Agility for Digitally Driven Business >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> > > > -- > Associate Technical Lead | WSO2 Inc. > lean.enterprise.middleware > > mobile: *+94728671315* > > -- Rukshan C. Premathunga | Associate Technical Lead | WSO2 Inc. (m) +94711822074 | (w) +94112145345 | Email: [email protected] GET INTEGRATION AGILE Integration Agility for Digitally Driven Business
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
