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?

posta 2 anni fa708 visualizzazioni
2 Risposte
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
con risposta 2 anni fa
AWS
ESPERTO
verificato 2 anni fa
  • 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.

con risposta 2 anni fa
AWS
ESPERTO
verificato 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande