cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USQL: Only two OR statements honored when aggregate with GROUP BY?

fstekelenburg
DynaMight Pro
DynaMight Pro

It appears as if only the first two statements in a group of OR statements are honoured, if the result is aggregated by a GROUP BY construction.

If we use a query in USQL like the one below:

SELECT name, count(*) from useraction where usersession.userSessionId = "<SOME ID>" and usersession.userType = "REAL_USER" AND type="Load" AND (name STARTSWITH "https://some.url" OR name STARTSWITH "loading" OR name STARTSWITH "SOME TEXT" OR name STARTSWITH "Homepage") GROUP BY name

We only get results of the first two statements of four in the (...OR...) group.
If we chance the order, the outcome changes accordingly.

Which misses results, that can be seen with the plain query:

SELECT name from useraction where usersession.userSessionId = "<SOME ID>" and usersession.userType = "REAL_USER" AND type="Load" AND (name STARTSWITH "https://some.url" OR name STARTSWITH "loading" OR name STARTSWITH "SOME TEXT" OR name STARTSWITH "Homepage")

A ticket with ONE support is opened in the meantime.

Kind regards, Frans Stekelenburg                 Certified Dynatrace Associate | measure.works, Dynatrace Partner
2 REPLIES 2

fstekelenburg
DynaMight Pro
DynaMight Pro

Update: I am easily able to reproduce this in the Dynatrace Demo environment.
Use 4 OR options and play around in the order, and you will notice that only the first two statements are used/honored.

How to reproduce in Demo:

SELECT name, count(*) from useraction where usersession.userSessionId="REDCCUGMPRPRVIFQFCBFVUPEQBMMLCAL-0" AND (name STARTSWITH "Loading" OR name STARTSWITH "search" OR name STARTSWITH "/easytravel/rest/journeys" OR name STARTSWITH "/easytravel/rest/login") GROUP BY name

Kind regards, Frans Stekelenburg                 Certified Dynatrace Associate | measure.works, Dynatrace Partner

Latest One Support update:

Our lab confirmed that we retrieve only first two conditions for the name as you suggested and is currently investigating the root cause. I will update you if there is any updates.

Kind regards, Frans Stekelenburg                 Certified Dynatrace Associate | measure.works, Dynatrace Partner

Featured Posts