2020年12月30日星期三

Filtering query by two values in same ARRAY or STRUCTs in Firebase Analytics BigQuery database

This question is a follow-up to this initial question.

In the previous example, we found how to filter an ARRAY of STRUCTs from Firebase's Analytics database.

Now here is the new challenge on top:

What we are trying to do

My thinking was, since we already did:

UNNEST(event_params) AS ep

This means that event_params is now flattened, so that means its values inside from the following ARRAYS:

  • value.string_value: can access values;
  • value.int_value: can access values;
  • etc..

So my thinking goes, since I managed to access value.string_value = 'Restaurant profile', it should be no problem to also access the other value you can see in the example called "restaurant_id", so I add some more AND statements:

  ep.key = 'restaurant_id' AND    ep.value.int_value = 2045881 AND  

But as you can imagine since I'm posting about it, the result was not quite what was expected 😂😂😂 even though technically BigQuery did accept my solution:

Empty results

Any idea what is wrong in my initial query and how I can fix it?

https://stackoverflow.com/questions/65516247/filtering-query-by-two-values-in-same-array-or-structs-in-firebase-analytics-big December 31, 2020 at 11:23AM

没有评论:

发表评论