我正在为配置单元表中的数据集构建模式。如何在Hive表中为数据集创建模式?
处理之后我必须写入数据到S3。
我需要根据日期附加json图像格式重新组织和分组用户id交互准备。
为了构建这个模式,我准备了一个带有数组的结构类型。
fields = [
StructField("expUserId", StringType(), True),
StructField("recordDate", StringType(), True),
StructField("siteId", StringType(), True),
StructField("siteName", StringType(), True),
StructField("itineraryNumber", StringType(), True),
StructField("travelStartDate", StringType(), True),
StructField("travelEndDate", StringType(), True),
StructField("destinationID", StringType(), True),
StructField("lineOfBusiness", StringType(), True),
StructField("pageViewMap", MapType(StringType(),ArrayType(StructType([
StructField("PageId", StringType(), True),
StructField("count", LongType(), True)]))), True)
]
schema = StructType(fields)
return schema
该模式是否正确?如何将DataFrame转换为下面的json模式类型。
请问您可以替换截图并使用原始文本进行复制。这将会更容易给你一些关于如何处理数据集的额外提示。谢谢! –