同一段SQL,在MYSQL中測試通過,挪到大數據執行報錯:
org.apache.spark.sql.AnalysisException: expression 'xxx' is neither present in the group by, nor is it an aggregate function. Add to group by or wrap in first(or first_value)...
大數據查詢遇到這個錯誤,解決方法已經提示。就是在xxx外面包裹first()函數。
至於原因: