FIRST() 函数:Unrecognized 目前不支持作为解析函数

FIRST() function: Unrecognized is not currently supported as an analytic function

当我 运行 aerobic-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

错误:目前不支持未识别的作为分析函数。不确定这里有什么问题。

我想 return index=2 的第一个 customDimemsion 值及其首次记录的日期。由于 customDimensionhits 都是重复的字段,并且以某种方式分开,不确定这是否可能。

SQL 标准中解析函数的正确名称是 FIRST_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

更新回答问题

I want to return the first customDimemsion value for index=2 together with the date it was first recorded.

我会尝试使用 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)