什么';s在go中写入拼花地板文件的时间戳格式
我试图在拼花文件中编写一个Go结构并上传到S3。我应该为结构中的timestamp参数指定什么格式和类型,以便athena在读取拼花地板文件时显示正确的时间戳什么';s在go中写入拼花地板文件的时间戳格式,go,parquet,amazon-athena,Go,Parquet,Amazon Athena,我试图在拼花文件中编写一个Go结构并上传到S3。我应该为结构中的timestamp参数指定什么格式和类型,以便athena在读取拼花地板文件时显示正确的时间戳 type example struct { ID int64 `parquet:"name=id, type=INT64"` CreatedAt int64 `parquet:"name=created_at,type=TIMESTAMP_MILLIS"` } ex := e
type example struct {
ID int64 `parquet:"name=id, type=INT64"`
CreatedAt int64 `parquet:"name=created_at,type=TIMESTAMP_MILLIS"`
}
ex := example{}
ex.ID = int64(10)
ex.CreatedAt = time.Now().Unix()
fw, err := ParquetFile.NewLocalFileWriter("new.parquet")
pw, err := ParquetWriter.NewParquetWriter(fw, new(example), 1)
pw.Write(ex)
Upload the file new.parquet to S3
参考-。我在Athena中创建了一个具有int和timestamp字段的表,并尝试查询该表。日期显示为-1970-01-1821:54:23.751。
其中没有与当前时间戳匹配的位置 例如
package main
import (
"fmt"
"time"
)
func main() {
type example struct {
CreatedAt int64 `parquet:"name=created_at,type=TIMESTAMP_MILLIS"`
}
ex := example{}
ex.CreatedAt = time.Now().UnixNano() / int64(time.Millisecond)
fmt.Println(ex.CreatedAt)
}
游乐场:
输出:
1257894000000