How do I apply schema with nullable = false to json reading

前端 未结 2 1802
暗喜
暗喜 2021-01-11 17:46

I\'m trying to write some test cases using json files for dataframes (whereas production would be parquet). I\'m using spark-testing-base framework and I\'m running into a s

2条回答
  •  自闭症患者
    2021-01-11 18:17

    The workAround aboves ensures there is a correct schema, but null values are set to default ones. In my case when an Int does not exist in the json String it is set to 0.

提交回复
热议问题