Google bigquery 将unix时间戳转换为avro并存储在BigQuery中
Avro模式:Google bigquery 将unix时间戳转换为avro并存储在BigQuery中,google-bigquery,avro,Google Bigquery,Avro,Avro模式: { "name": "Entity", "type": "record", "namespace": "com.foobar.entity", "fields": [ { "name": "attribute", "type": "string" }, { "name": "value", "type": "int" }, { "name": "timestamp"
{
"name": "Entity",
"type": "record",
"namespace": "com.foobar.entity",
"fields": [
{
"name": "attribute",
"type": "string"
},
{
"name": "value",
"type": "int"
},
{
"name": "timestamp",
"type": { "type": "long", "logicalType": "timestamp-micros" }
}
]
}
源时间戳为Unix格式,精度为毫秒
当我将这些记录放入BigQuery时,我会在BigQuery数据预览中获得类似于1970-01-19 01:18:19.415 UTC
的值。但是,我存储的值是1559899418
,即7月7日星期五。2019年6月09:23:38
。你知道为什么吗
参考资料:您的时间戳被关闭了1000倍。实际上,
1559899418
对应于7月7日星期五。2019年6月09:23:38,但这是秒精度(),不是毫秒。
而1559899
(1559899418的千分之一)确实对应于1970-01-19 01:18:19