Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google analytics 对嵌套的BigQuery进行子句化不需要';正如所料_Google Analytics_Google Bigquery_Nested - Fatal编程技术网

Google analytics 对嵌套的BigQuery进行子句化不需要';正如所料

Google analytics 对嵌套的BigQuery进行子句化不需要';正如所料,google-analytics,google-bigquery,nested,Google Analytics,Google Bigquery,Nested,我基本上是在尝试查询一个名为hits.CustomDimension.index的列,因此我必须嵌套多次才能访问数据。我正在尝试进行筛选,以便它仅显示以下查询中hits.CustomDimension.index=16的行,但它会返回任何在某处具有CustomDimension.index=16的观测的所有CustomDimension行。 不知道我做错了什么?正如您在我添加的图像中所看到的,仍然显示customDimension.index=16的所有自定义维度,我只希望将其展平 SELECT

我基本上是在尝试查询一个名为hits.CustomDimension.index的列,因此我必须嵌套多次才能访问数据。我正在尝试进行筛选,以便它仅显示以下查询中hits.CustomDimension.index=16的行,但它会返回任何在某处具有CustomDimension.index=16的观测的所有CustomDimension行。 不知道我做错了什么?正如您在我添加的图像中所看到的,仍然显示customDimension.index=16的所有自定义维度,我只希望将其展平

SELECT * EXCEPT(hit, hits)

FROM ***,

UNNEST(hit) h

CROSS JOIN UNNEST(customDimensions) cd 

WHERE cd.index = 16 AND timeOnSite IS NOT NULL

自定义维度存储为数组。如果只想查看特定的自定义维度,可以从select语句中排除hit和hit列

SELECT * EXCEPT(hits, hit),
FROM ******.ga_sessions_export, 
UNNEST(hits) hit,
UNNEST(customDimensions) cd
WHERE cd.index = 16
LIMIT 10
试试下面

SELECT * 
FROM ******.ga_sessions_export, 
UNNEST(hits) h 
CROSS JOIN UNNEST(h.customDimensions) cd 
WHERE cd.index = 16 
LIMIT 10   
原始查询中的问题是,您不是按hits.customDimensions筛选的,而是按名为customDimensions的单独字段筛选的

vs


这仍然返回cd.index=16出现的任何观察结果!附上一张照片,我知道了。您只想看到cd.index=16。我现在正在编辑,同一期。如果观察到自定义维度11出现,则返回所有自定义维度。我认为您最好用更多细节/示例定义您的问题。请仔细阅读我的答案!你可能会注意到一些有用的东西。这是问题的关键answer@linacar231这个解决方案是正确的。您可能混淆了字段(GA数据有三个名为customDimensions的字段)