Apache spark Spark-写入流不接受架构更改
当我创建自己的DF并尝试在那里工作时,我尝试使用模式更改进行编写,但在这里失败 .. 我错过了什么。此外,我还想更改客户端事件时间的数据类型Apache spark Spark-写入流不接受架构更改,apache-spark,pyspark,Apache Spark,Pyspark,当我创建自己的DF并尝试在那里工作时,我尝试使用模式更改进行编写,但在这里失败 .. 我错过了什么。此外,我还想更改客户端事件时间的数据类型 from pyspark.sql.functions import col, to_date, struct def writeToBronze(sourceDataframe, bronzePath, streamName): (sourceDataframe #.withColumn(FILL_IN) #.filter(col(FI
from pyspark.sql.functions import col, to_date, struct
def writeToBronze(sourceDataframe, bronzePath, streamName):
(sourceDataframe
#.withColumn(FILL_IN)
#.filter(col(FILL_IN)
.withColumn("eventParams", struct(
col("eventParams.game_keyword"),
col("eventParams.app_name"),
col("eventParams.scoreAdjustment"),
col("eventParams.platform"),
col("eventParams.app_version"),
col("eventParams.device_id"),
col("eventParams.client_event_time").alias("eventDate"),
col("eventParams.amount")))
.filter(sourceDataframe.eventParams.client_event_time.isNotNull())
#FILL_IN
.writeStream
.format("delta")
.option("checkpointLocation", bronzePath + "/_checkpoint")
.option('overwriteSchema', 'true')
.queryName(streamName)
.outputMode("append")
.start(bronzePath)
)您的问题不清楚。您希望对架构进行哪些更改?涉及哪些数据类型?你遇到过什么错误?