[英]spark createdataframe cannot infer schema - default data types?
Creating a spark dataframe in databricks using createdataframe results in error: 'Some of types cannot be determined after inferring'使用 createdataframe 在 databricks 中创建 spark 数据帧会导致错误:“推断后无法确定某些类型”
I know I can specify the schema but that doesn't help if I'm creating the dataframe each time with source data from an API and they decide to restructure it.我知道我可以指定模式,但是如果我每次都使用来自 API 的源数据创建数据框并且他们决定对其进行重组,那将无济于事。
Instead I'd like to tell spark to use 'string' for any column where a data type cannot be inferred.相反,我想告诉 spark 对无法推断数据类型的任何列使用“字符串”。
Is this possible?这可能吗?
Thanks谢谢
This can be easily handled with schema evaluation with delta
format.这可以通过使用
delta
格式的模式评估轻松处理。 Quick ref: https://databricks.com/blog/2019/09/24/diving-into-delta-lake-schema-enforcement-evolution.html快速参考: https : //databricks.com/blog/2019/09/24/diving-into-delta-lake-schema-enforcement-evolution.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.