Athena Presto SQLメモ(随時更新)
はじめに
Athenaで日付を扱う場合は、元データの形式がJavaのTIMESTAMP形式
が必須なので、違う形式の場合はsql側で処理する必要がある。
Amazon Athena のテーブルにクエリを実行すると、TIMESTAMP の結果が空になる
iso8601形式の文字列をtimestamp型に変更
from_iso8601_timestamp(started_at)
経過時間(秒)を計算
date_diff('second', from_iso8601_timestamp(started_at), from_iso8601_timestamp(completed_at))
date_diff(unit, timestamp1, timestamp2) → bigint
Returns timestamp2 - timestamp1 expressed in terms of unit.
返り値の肩はbigint
経過時間を分に切り上げる
CEILING(cast(duration as DOUBLE) / 60)
Author And Source
この問題について(Athena Presto SQLメモ(随時更新)), 我々は、より多くの情報をここで見つけました https://qiita.com/dehio3/items/0e166b2ff9dd6799d21f著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .