AWS胶粘作业将字符串映射为日期和时间格式,同时从CSV转换为拼花

编程入门 行业动态 更新时间:2024-10-28 03:19:54
本文介绍了AWS胶粘作业将字符串映射为日期和时间格式,同时从CSV转换为拼花的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在从csv转换为镶木地板时,使用csv中映射的字段后的AWS粘合ETL作业读取为日期和时间类型的字符串。 这是实际的csv文件

while converting from csv to parquet, using AWS glue ETL job following mapped fields in csv read as string to date and time type. this is the actual csv file

在映射和转换后,提交的日期为空,时间与今天的日期连接在一起

after mapping and converting, date filed is empty and time is concatenated with today's date

如何使用正确的日期和时间格式进行转换?

How to convert with proper date and time format?

推荐答案

它使用presto数据类型,因此数据应采用正确的格式

It uses presto datatypes so data should be in correct format

DATE日历日期(年,月,日)。

DATE Calendar date (year, month, day).

示例:日期'2001-08-22'

Example: DATE '2001-08-22'

时间一天中的时间(小时,分钟,秒,英里一秒钟)没有时间区域。这种类型的值在会话时间区域中解析和呈现。

TIME Time of day (hour, minute, second, millisecond) without a time zone. Values of this type are parsed and rendered in the session time zone.

示例:TIME '01:02:03.456'

Example: TIME '01:02:03.456'

TIMESTAMP即时时间,其中包括的日期和时间,没有时区。此类值会在会话时区中解析并呈现。

TIMESTAMP Instant in time that includes the date and time of day without a time zone. Values of this type are parsed and rendered in the session time zone.

示例:TIMESTAMP'2001-08-22 03:04:05.321'

Example: TIMESTAMP '2001-08-22 03:04:05.321'

您可以使用

df = df.withColumn(col, to_timestamp(col, 'dd-MM-yyyy HH:mm')) df = df.withColumn(col, to_date(col, 'dd-MM-yyyy')) df = df.withColumn(col, date_format(col, 'HH:mm:ss'))

更多推荐

AWS胶粘作业将字符串映射为日期和时间格式,同时从CSV转换为拼花

本文发布于:2023-05-30 15:31:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/371047.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:拼花   作业   字符串   转换为   日期

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!