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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인