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?

gefragt vor 2 Jahren708 Aufrufe
2 Antworten
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
beantwortet vor 2 Jahren
AWS
EXPERTE
überprüft vor 2 Jahren
  • 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.

beantwortet vor 2 Jahren
AWS
EXPERTE
überprüft vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen