小编von*_*sch的帖子

在 BigQuery SQL for Data Studio 中格式化 Firestore 时间戳

我们将 Firestore 数据导入 BigQuery 以在数据洞察中生成报告。

以下适用于 SQL 时间戳,但不适用于 Firestore-JSON 时间戳。

SELECT 
    PARSE_TIMESTAMP('%Y%m%d', JSON_VALUE(`data`, "$.updated_at")) AS `updated_at`
FROM 
    `project.firestore_export.profiles_raw_latest`
Run Code Online (Sandbox Code Playgroud)

我们的日期在名为 的 JSON 字段timestamp的列中采用 Firestore格式。dataupdated_at

如何获得最终在 Data Studio 中使用的可用日期格式?

编辑:当我查询没有JSON_VALUE它返回的字段时null,它是 Firestore 中的标准时间戳格式。当我在 BigQuery 中预览数据时,它会以 JSON 对象的形式返回:{"_seconds":1569585420,"_nanoseconds":586000000}

sql google-bigquery google-data-studio google-cloud-firestore

2
推荐指数
1
解决办法
703
查看次数

Rewrite dynamic conditional statement in Javascript

I'm building a grid where a new item must fit in the next available spot. Items can be 3:2 or 2:3, the grid is 12 columns wide.

How can I rewrite this looped conditional statement to remove the hardcoded limit and accepts input of 3:2 or 2:3 (currently x:3,y:2)?

        const check = (
            !grid[rowY + 0][columnX + 0] &&  // @TODO: Hard coded limit
            !grid[rowY + 0][columnX + 1] &&  // @TODO: Hard coded limit
            !grid[rowY + 0][columnX + 2] …
Run Code Online (Sandbox Code Playgroud)

javascript conditional collision-detection

1
推荐指数
1
解决办法
51
查看次数