finding length of string in spark SQL

0

Hi, I am trying to find length of string in spark sql, I tried LENGTH, length, LEN, len, char_length functions but all fail with error - ParseException: '\nmismatched input 'len' expecting <EOF>(line 9, pos 9). I have imported - from pyspark.sql.functions import * in my script. What is the actual function and what I am missing?

已提問 2 年前檢視次數 708 次
2 個答案
2

the problem is probably somewhere else as "length" is indeed a spark sql function

https://spark.apache.org/docs/latest/api/sql/#length

can you please post the whole SQL statement you're trying to execute?

AWS
Alex_T
已回答 2 年前
AWS
專家
已審閱 2 年前
  • I rechecked the code and found that athena syntax was left for date conversion in length function, which was causing the issue, now the query runs

1

Length is indeed a valid method, and the correct latest documentation link is here: https://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.functions.length.html

Please provide a code snippet to resolve your question.

已回答 2 年前
AWS
專家
已審閱 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南