pyspark - 一些使用合理化胶水的数组数据类型结构不起作用
问题描述
我已经以 JSON 格式展平了文件,它工作正常。但是结构内的一些数组对象没有展平,在数据目录中它显示在 bigInt 中。如我错了请纠正我。
它只选择了 office.items 和 office.selected 所需的输出应该是选择的数据类型,并使其成为列格式,如 items.element.officeName、items.element.address、items.element.address.country 等
这是代码
glue_temp_storage = "s3://script/"
glue_relationalize_output_s3_path= "s3://script/"
dfc_root_table_name = "root"
sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
job = Job(glueContext)
job.init(args['JOB_NAME'], args)
datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "stitchdb", table_name = "listingsandreviews", transformation_ctx = "datasource0")
relationalized_json = Relationalize.apply(frame = datasource0, staging_path = "glue_temp_storage",name = "dfc_root_table_name", transformation_ctx = "relationalized_json")
dfc = relationalized_json.select('dfc_root_table_name')
datasink2 = glueContext.write_dynamic_frame.from_options(frame =dfc , connection_type = "s3", connection_options = {"path": "s3://script"}, format = "csv", transformation_ctx = "datasink2")
job.commit()
解决方案
推荐阅读
- api - Financial Modeling Prep API 是否有速率限制?
- python - 测试返回 JsonReponse 的基于类的 Django 视图
- web - Heroku 部署
- gatsby - 更新 Prismic CMS 内容时在 gatsby 网站上显示新内容
- blazor - 为什么不改变变量的值
- pycharm - 现在强制 lsyncd 到 sybc
- google-cloud-platform - 有什么方法可以从 Windows 中的 powershell 打开 google cloud shell
- c++ - UE4 - 如何在给定 4 个屏幕坐标的情况下缩放纹理或材质?
- spring-integration - Spring 集成 Java DSL 示例
- swift - 如何将变量声明为 Equatable?