Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
cómo escribir la fila Spark sql DF en dos líneas a s3

Marco de datos :

 Df row1 : Ravi Computers 20 Df row2 : Jon Electronics 21 Df row3 : Sam arts 20

¿Cómo puedo escribir para escribir en el archivo s3 como

 Line1: Index:Ravi Line2: Ravi Computers 20 Line3: Index:Jon Line4: Jon Electronics 21 Line5: Index:Sam Line6: Sam arts 20
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para escribir Spark SQL DataFrame en 2 líneas en S3, debe map cada fila de DF a la cadena respectiva con una nueva línea \n :

 val df = sc.parallelize(Seq(("Ravi","Computers",20),("Jon","Electronics",21), ("Sam","arts",20))).toDF df.map(r => s"Index:${r.getString(0)}\n${r.getString(0)} ${r.getString(1)} ${r.getInt(2)}").write.csv("s3n://........")

Escribirá el DF en el formato de salida esperado:

 Line1: Index:Ravi Line2: Ravi Computers 20 Line3: Index:Jon Line4: Jon Electronics 21 Line5: Index:Sam Line6: Sam arts 20
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!