Description
//代码占位符 val clone = spark.cloneSession() clone.conf.set("spark.sql.legacy.interval.enabled", "true") clone.sql("select '2023-01-01'+ INTERVAL 1 YEAR as b").show() clone.sql("select '2023-01-01' as a").selectExpr("a + INTERVAL 1 YEAR as b").show()
The first one can be executed successfully, but the second one cannot be executed successfully.
Because selectExpr and sql use different sparkSession conf.