1 统计聚合函数除以零问题
统计聚合函数:std, stddev, stddev_samp, variance, var_samp, skewness, kurtosis, covar_samp, corr
版本<3.1, 返回nan;版本="">=3.1,返回NULL。3.1,>
返回NaN设置spark.sql.legacy.statisticalAggregate为true。
2 grouping_id()
版本<3.1返回整型, 版本="">=3.1返回长整型。3.1返回整型,>
使用整型设置spark.sql.legacy.integerGroupingId为true。
3 SQL UI
版本>=3.1,使用formatted模式展示执行计划。
使用旧版本设置spark.sql.ui.explainMode为extended。
4 时间格式
函数:from_unixtime, unix_timestamp,to_unix_timestamp, to_timestamp, to_date
版本>=3.1, 非法时间格式抛出异常;之前版本返回NULL。
5 重名列
版本>=3.1, Parquet, ORC, Avro, JSON数据源中检测重名列,抛出异常org.apache.spark.sql.AnalysisException: Found duplicate column(s) in the data schema
。
大小写控制spark.sql.caseSensitive
6 结构体和映射转字符串
版本>=3.1使用花括号包装,之前版本使用中括号。
使用旧版本设置spark.sql.legacy.castComplexTypesToString.enabled为true。
7 空元素转字符串
数据结构:structure, array, map
版本>=3.1转换为NULL字符串, 旧版本转换为空字符串
使用旧版本设置spark.sql.legacy.castComplexTypesToString.enabled为true。