Azure Stream Analytics query language get value by key from array of key value pairs -


i trying extract specific value array property in stream analytics query language.

my data looks follows:

"context": {     "custom": {         "dimensions": [{             "macaddress": "ma"         },         {             "ipaddress": "ipaddr"         }]     } 

}

i trying obtain result has "macaddress", "ipaddress" column titles , "ma", "ipaddr" rows.

i achieving this query:

select     getrecordpropertyvalue(getarrayelement(mysource.context.custom.dimensions, 0), 'macaddress') macaddress,     getrecordpropertyvalue(getarrayelement(mysource.context.custom.dimensions, 1), 'ipaddress') ipaddress, 

i trying use cross apply far no luck. below cross apply query:

select     flat.arrayvalue.macaddress macaddress,     flat.arrayvalue.ipaddress ipaddress   [ffapi-track-events] mysource   cross apply getarrayelements(mysource.context.custom.dimensions) flat  

this 1 produces 2 rows instead of one:

macaddress, ipaddress ma        ,           , ipaddr 

so i'm missing precisely flattening when writing that.

i bypass hardcoding index 0 it's not guaranteed macaddress won't switch places "ipaddress"... need findelementinarray condition, or means join dimensions array.

is there such thing?

thank you.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -