当从 Glue 2.0 切换到 3.0 时,这意味着也从 Spark 2.4 切换到 3.1.1,我的作业在处理 1900 年之前的时间戳时开始失败,并出现以下错误:
An error occurred while calling z:org.apache.spark.api.python.PythonRDD.runJob.
You may get a different result due to the upgrading of Spark 3.0: reading dates before 1582-10-15 or timestamps before 1900-01-01T00:00:00Z from Parquet INT96 files can be ambiguous,
as the files may be written by Spark 2.x or legacy versions of Hive, which uses a legacy hybrid calendar that is different from Spark 3.0+s Proleptic Gregorian calendar.
See more details in SPARK-31404. …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用PySpark处理包含带有动态键的结构列的 json 文件。
结构列的架构如下所示:
{
"UUID_KEY": {
"time": STRING
"amount": INTEGER
}
}
Run Code Online (Sandbox Code Playgroud)
数据如下:
| ID | json_列 |
|---|---|
| 1 | “{1:{金额:1,时间:2},2:{金额:10,时间:5}}” |
| 2 | “{3:{金额:1,时间:2},4:{金额:10,时间:5}” |
目前,我将结构列作为字符串,因为通过指定/推断模式加载 JSON 不起作用,因为第一层的键是随机生成的,并且数据太多。第二层始终相同,它包含amount和time。
有没有办法在不知道第一层的键的情况下将此 JSON 字符串平铺到amount和列中?time