spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lalwani, Jayesh" <>
Subject Re: spark partitionBy with partitioned column in json output
Date Tue, 05 Jun 2018 02:41:04 GMT

This behavior is by design. If you provide partitionBy, Spark removes the columns from the

From: purna pradeep <>
Date: Monday, June 4, 2018 at 8:00 PM
To: "" <>
Subject: spark partitionBy with partitioned column in json output

im reading below json in spark

    {"bucket": "B01", "actionType": "A1", "preaction": "NULL", "postaction": "NULL"}
    {"bucket": "B02", "actionType": "A2", "preaction": "NULL", "postaction": "NULL"}
    {"bucket": "B03", "actionType": "A3", "preaction": "NULL", "postaction": "NULL"}


Now im writing the same to a json output as below

    df.write. format("json"). mode("append"). partitionBy("bucket","actionType"). save("output.json")

and the output.json is as below


bucket,actionType columns are missing in the json output, i need partitionby columns as well
in the output


The information contained in this e-mail is confidential and/or proprietary to Capital One
and/or its affiliates and may only be used solely in performance of work or services for Capital
One. The information transmitted herewith is intended only for use by the individual or entity
to which it is addressed. If the reader of this message is not the intended recipient, you
are hereby notified that any review, retransmission, dissemination, distribution, copying
or other use of, or taking of any action in reliance upon this information is strictly prohibited.
If you have received this communication in error, please contact the sender and delete the
material from your computer.
View raw message