UNNEST(hit.eCommerceAction), Google Bigquery

前端 未结 1 904
渐次进展
渐次进展 2021-01-21 17:01

I used the same logic to unnest hit.eCommerceAction, but it\'s not working as other fields. Any help on this problem? Also, Is the max(if()) function the right function to use t

相关标签:
1条回答
  • 2021-01-21 17:40

    I can reproduce the error with a simpler query:

    #standardSQL
    SELECT DISTINCT hit.eCommerceAction.action_type 
    FROM `73156703.ga_sessions_20170109` t
      , UNNEST(hits) hit
      , UNNEST(hit.customDimensions) customDimensions
      , UNNEST(hit.eCommerceAction) as eCommerceAction
    

    The issue here is that eCommerceAction is not a REPEATED record, hence there is no array to UNNEST.

    Fixed query:

    #standardSQL
    SELECT DISTINCT hit.eCommerceAction.action_type 
    FROM `ga_sessions_20170109`  t
      , UNNEST(hits) hit
      , UNNEST(hit.customDimensions) customDimensions
    
    0 讨论(0)
提交回复
热议问题