Google bigquery FIRST()函数:当前不支持将Unrecognized作为分析函数

Google bigquery FIRST()函数:当前不支持将Unrecognized作为分析函数,google-bigquery,Google Bigquery,当我运行hoodial-forge-504:job_4_p6sq_0C5_3B-NVyVgg-Y2gf4作业时,我收到了一条非常奇怪的错误消息 SELECT fullVisitorId as fullvisitorid, date, (visitStartTime+hits.time) as time, first(customDimensions.value) over(partition by fullVisitorId) F

当我运行hoodial-forge-504:job_4_p6sq_0C5_3B-NVyVgg-Y2gf4作业时,我收到了一条非常奇怪的错误消息

SELECT  fullVisitorId as fullvisitorid,
        date,
        (visitStartTime+hits.time) as time,
        first(customDimensions.value) over(partition by fullVisitorId)
        FROM flatten([google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910] ,customDimensions)
where customDimensions.index=2
LIMIT 100
错误:当前不支持将Unrecognized作为分析函数。我不确定这里出了什么问题


我想返回index=2的第一个customDimemsion值以及它第一次记录的日期。因为customDimension和hits都是重复的字段,并且以某种方式分开,所以不确定这是否可行。

SQL标准中分析函数的正确名称是FIRST\u VALUE。首先是BigQuery中的聚合函数。因此,您的查询将是

SELECT  fullVisitorId as fullvisitorid,
        date,
        (visitStartTime+hits.time) as time,
        first_value(customDimensions.value) over(partition by fullVisitorId)
        FROM flatten([google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910] ,customDimensions)
where customDimensions.index=2
LIMIT 100
更新以回答问题

我想同时返回index=2的第一个customDimemsion值 第一次录制的日期

我会尝试使用hits.customDimensions.[index | value],即

SELECT fullVisitorId, date, visitStartTime + first_hit_time, value FROM (
SELECT  fullVisitorId,
        date,
        visitStartTime,
        FIRST(hits.customDimensions.value) WITHIN hits as value,
        FIRST(hits.time) WITHIN hits as first_hit_time
FROM
[google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
WHERE hits.customDimensions.index = 2)

您是否知道如何重写此内容,因为展平不适用于表\u日期\u范围,而且我们实际上查询了多天。展平不适用于表\u日期\u范围是一个麻烦,但我认为可以通过使用展平选择*从表\u日期\u范围。。。相反另外,我认为使用扁平化几乎总是一个错误,因此如果你能说出你正在做的实际任务,也许有一种方法可以不使用扁平化来完成。任务是问题的最后一个短语,最终我想得到一个fullvisitorid列表,对于每个唯一的fullvisitorid,只有一行具有第一个customdimension值,设定的时间。如果不清楚,请告诉我。只是澄清一下-它第一次录制的日期不是简单的visitStartTime,因为first hits.time总是0?我们的index=2 customDimension是用户输入的搜索词,它不是用户在网站上的第一次交互,所以它不是hits.time=0,这可能是第五次甚至更晚与网站互动。可能是30号什么的。这有用吗?甚至可能在他访问该网站并进行第一次搜索的几天后。我们希望使用此信息,以便计算使用搜索和实际购买之间经过的时间