在我的Android应用程序中,我正在记录用户选择的项目数量,如下所示
public static void trackItemsSelectedCount(Context context, int count) {
Bundle bundle = new Bundle();
bundle.putInt("count", count);
getAnalytics(context).logEvent("items_selected", bundle);
}
在BigQuery中,我可以计算出事件items_selected
的条目数量
SELECT event_dim.name as event,
COUNT(event_dim.name) as event_count
FROM TABLE_DATE_RANGE(package_ANDROID.app_events_intraday_, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP())
where event_dim.name contains 'items_selected'
GROUP BY event
ORDER BY event DESC LIMIT 1;
我希望获得event_dim.params.value.int_value
的{{1}}和count
到目前为止,我正在执行以下操作,但这可能不准确(因为event_dim.params.key
没有出现在任何地方)。任何更精确的查询的想法将不胜感激:
event_dim.params.key
SELECT event_dim.name as event,
COUNT(event_dim.name) as event_count ,
COUNT(event_dim.params.value.int_value) as value_count
FROM TABLE_DATE_RANGE(package_ANDROID.app_events_intraday_, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP())
where event_dim.name contains 'items_selected'
GROUP BY event
ORDER BY event DESC LIMIT 1;
答案 0 :(得分:0)
SELECT
SUM((SELECT params.value.int_value FROM x.params WHERE params.key = 'count')) AS count
FROM package_ANDROID.app_events_20170123, UNNEST(event_dim) AS x
WHERE x.name = 'items_selected'