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?

asked 2 years ago697 views
2 Answers
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
answered 2 years ago
AWS
EXPERT
reviewed 2 years ago
  • 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.

answered 2 years ago
AWS
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions