Feb 12 2019
11:58 AM
- last edited on
Apr 07 2022
05:40 PM
by
TechCommunityAP
Feb 12 2019
11:58 AM
- last edited on
Apr 07 2022
05:40 PM
by
TechCommunityAP
When rows are filtered such that zero rows are sent to the evaluate pivot clause, the subsequent references to fields generated by the pivot are considered syntax errors.
Perf
| where 1 == 2 // intentionally generate zero rows...
| evaluate pivot (CounterName, max(Max)) // would normally generate a column per unique CounterName
| where SomeCounterThatExists == 2 // and this would succeed.
Given that there are ZERO rows for the where to evaluate, I was hoping that it would short circuit the evaluation and not throw an error.
Any suggestions for how to avoid errors in this case?
Feb 12 2019 11:11 PM
Hi,
I am not sure what you are trying to achieve. For me it is normal that you get error because if there are no results there is nothing to evaluate. Is there any particular use case you are trying to achieve? Can you elaborate more on what end result you want to get if there is no data? Why resulting an error if there is no data a problem?
Feb 12 2019 11:18 PM
Feb 12 2019 11:31 PM
Ok. I cannot quite get the use case as from math point of view this is working fine. I would assume you can implement some logic in your queries to check first if you have any rows returned at all do the evaluation but if you do not have return something else. Other option is if you do not have results to populate some dummy results so the evaluation operation can have something to work with. If you have to implement that in every query won't be pretty though. You can probably also do a union with dymmy values to make sure you have something to work with. If anyone else can propose a better solution I would be happy to hear it
Feb 13 2019 12:12 AM
Feb 13 2019 12:16 AM
Ok. Apologies. I was not aware that is a request. As this is related to the query language it might be best to address this request towards Azure Data Explorer service as they own the query language. They probably also have user voice or you can use whatever channel that you are aware to reach them.
Feb 13 2019 12:22 AM