[ https://issues.apache.org/jira/browse/ASTERIXDB-2427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Jacobs reassigned ASTERIXDB-2427: ---------------------------------------- Assignee: Dmitry Lychagin > Plan with two instances of create-query-uid() optimizing groupby incorrectly. > ----------------------------------------------------------------------------- > > Key: ASTERIXDB-2427 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-2427 > Project: Apache AsterixDB > Issue Type: Bug > Reporter: Steven Jacobs > Assignee: Dmitry Lychagin > Priority: Major > > The groupby ends up grouping by nothing when it should group by the top > create-query-uid() > > Repro: > drop dataverse channels if exists; > create dataverse channels; > use channels; > create type UserLocation as { > location: circle, > userName: string > }; > create type EmergencyReport as { > reportId: uuid, > Etype: string, > location: circle > }; > create type EmergencyShelter as { > shelterName: string, > location: point > }; > create dataset UserLocations(UserLocation) > primary key userName; > create dataset Shelters(EmergencyShelter) > primary key shelterName; > create dataset Reports(EmergencyReport) > primary key reportId autogenerated; > create index u_location on UserLocations(location) type RTREE; > create type result as { > resultId:uuid > }; > create type channelSub as { > channelSubId:uuid > }; > create type brokerSub as { > channelSubId:uuid, > brokerSubId:uuid > }; > create type broke as { > DataverseName: string, > BrokerName: string, > BrokerEndpoint: string > }; > create dataset EmergenciesNearMeChannelResults(result) primary key resultId > autogenerated; > create dataset EmergenciesNearMeChannelChannelSubscriptions(channelSub) > primary key channelSubId; > create dataset EmergenciesNearMeChannelBrokerSubscriptions(brokerSub) primary > key channelSubId,brokerSubId; > create dataset Broker(broke) primary key DataverseName,BrokerName; > create function RecentEmergenciesNearUser(userName) { > ( > select report, shelters from > ( select value r from Reports r)report, > UserLocations u > let shelters = (select s.location from Shelters s where > spatial_intersect(s.location,u.location)) > where u.userName = userName > and spatial_intersect(report.location,u.location) > ) > }; > SET inline_with "false"; > insert into channels.EmergenciesNearMeChannelResults as a ( > with channelExecutionTime as current_datetime() > select result, channelExecutionTime, sub.channelSubId as > channelSubId,current_datetime() as deliveryTime, > (select b.BrokerEndPoint, bs.brokerSubId from > channels.EmergenciesNearMeChannelBrokerSubscriptions bs, > channels.Broker b > where bs.BrokerName = b.BrokerName > and bs.DataverseName = b.DataverseName > and bs.channelSubId = sub.channelSubId > ) as brokerSubIds > from channels.EmergenciesNearMeChannelChannelSubscriptions sub, > channels.RecentEmergenciesNearUser(sub.param0) result > ) returning (select a.channelExecutionTime group by a.channelExecutionTime); -- This message was sent by Atlassian JIRA (v7.6.3#76005)