Is there a way to stop Azure Data Explorer inferring the data types in an array?

67 Views Asked by At

I have a function that receives an array of values as a parameter, all those values it's supposed that be strings.

let SelectedValues = dynamic(["2022-08-14T13:05:17Z", "EconChgOvrDiff", "1"]);
let F = (SelectedValues:dynamic=dynamic([]), Limit:int=100)
{
MyTable
    | where Value in (SelectedValues)
    | limit Limit
}
;
F(SelectedValues)

The problem is that it seems like ADX is inferring the type of my strings that are a representation of a timestamp and ADX is converting those strings into an actual timestamp and therefore my query does not return the expected result.

you can see in the images below how ADX is modifying my value

Modified Value

Type of my Value

and I know that I can do the following and it works as expected, but I do really need to have that query into a function and be able to receive those values as parameters of the function.

MyTable
    | where Value in ("2022-08-14T13:05:17Z", "EconChgOvrDiff", "1")
    | limit 100

Thanks in advance!

1

There are 1 best solutions below

0
Rakesh Govindula On

I tried the same in my environment and I got same result. This might be the default nature in ADX when using dynamic arrays.

To avoid this, wrap your datetime string in single quotes('') like below.

let SelectedValues = dynamic(["EconChgOvrDiff", '"2022-08-14T13:05:17Z"',"1"]);

Now, it is taking it as string data type.

enter image description here

enter image description here