Google bigquery UNNEST(hit.eCommerceAction),Google Bigquery
我对unnest hit.eCommerceAction使用了相同的逻辑,但它与其他领域不一样。在这个问题上有什么帮助吗?另外,max(if())函数是否是用于获取两个hits.customeDimenison.value的正确函数Google bigquery UNNEST(hit.eCommerceAction),Google Bigquery,google-bigquery,Google Bigquery,我对unnest hit.eCommerceAction使用了相同的逻辑,但它与其他领域不一样。在这个问题上有什么帮助吗?另外,max(if())函数是否是用于获取两个hits.customeDimenison.value的正确函数 SELECT Date ,COUNT(DISTINCT FULLVISITORID) , product.v2ProductCategory ,max(if(customDimensions.index=2, customDimensions.valu
SELECT
Date
,COUNT(DISTINCT FULLVISITORID)
, product.v2ProductCategory
,max(if(customDimensions.index=2, customDimensions.value,null)) as dest
,max(if(customDimensions.index=21, customDimensions.value,null)) as pax
,eCommerceAction.action_type
,product.v2ProductName
FROM `table` as t
CROSS JOIN UNNEST(hits) AS hit
CROSS JOIN UNNEST(hit.customDimensions) AS customDimensions
CROSS JOIN UNNEST(hit.eCommerceAction) as eCommerceAction
CROSS JOIN UNNEST(hit.product) AS product
GROUP BY
Date
,product.v2ProductCategory
,eCommerceAction.action_type
,product.v2ProductName
我得到的错误代码是Error:UNNEST中引用的值必须是数组。UNNEST包含STRUCT类型的表达式我可以用更简单的查询重现错误:
#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
这里的问题是,ecommercialaction
不是一个重复的记录,因此没有数组来unest
固定查询:
#standardSQL
SELECT DISTINCT hit.eCommerceAction.action_type
FROM `ga_sessions_20170109` t
, UNNEST(hits) hit
, UNNEST(hit.customDimensions) customDimensions
你好,菲利佩,非常感谢你的回复。它对我有用。出于好奇,你知道我可以去哪些网站/教程了解更多关于google big query的信息吗?你好!这取决于你在寻找什么,但我所了解到的关于BigQuery的一切,我发帖感谢你!完成这份报告后我会看一看