Bird
0
0

Identify the error in this PySpark code snippet:

medium📝 Debug Q6 of 15
Hadoop - Performance Tuning
Identify the error in this PySpark code snippet:
df.write.format('parquet').option('compression', 'snappy').save()
AOption method is not supported
BWrong compression codec name
CMissing path argument in save() method
DIncorrect format name 'parquet'
Step-by-Step Solution
Solution:
  1. Step 1: Check save() method usage

    The save() method requires a path argument to specify where to save the file.
  2. Step 2: Validate other parts

    Compression codec 'snappy' is valid, format 'parquet' is correct, and option() method is supported.
  3. Final Answer:

    Missing path argument in save() method -> Option C
  4. Quick Check:

    save() needs path argument [OK]
Quick Trick: Always provide path in save() method [OK]
Common Mistakes:
  • Omitting path in save()
  • Using invalid compression codec
  • Wrong format string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Hadoop Quizzes