微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

根据日期,月份和年份将Spark Write流式传输到S3存储桶

如何解决根据日期,月份和年份将Spark Write流式传输到S3存储桶

我对此线程(How to write stream to S3 with year,month and day of the day when records were received?)中发布的要求非常相似。

但是没有用。谁能告诉我我在这里想念的东西吗?

val formatDf = df.selectExpr("CAST(value AS STRING)")
      .select(from_json($"value",schema).as("sInput")) // select the value and give one alias name
      .select("sInput.*") // flatten the struct field
      .withColumn("triggeringModels",explode($"triggeringModels")) // <-- explode the array field.
      .map(row => { 


returnObject //这是表达式的返回值 }

       .withColumn("year",functions.date_format(df.col("date"),"YYYY"))
     .writeStream
     .format("parquet")
     .option("path","path")
     .option("checkpointLocation","checkpointpath")
     .partitionBy("date")
     .start()```

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。