Skip to content

CSV files have double quotes in case of empty field values. How to avoid that? #86

Open
@sukanya-pai

Description

@sukanya-pai

Hi, I am trying to send a file from one server to a mainframe server working under SFTP protocol. So I used this package. I am facing the issue that if the field values are blank or empty, I am getting double quotes in place of nothing. I tried using nullValue and emptyValue options with multiple values like "", null,"u/0000", none of them works. I still see double quotes on mainframe server.

dataFrame.coalesce(1).write.
        format("com.springml.spark.sftp").
        option("host", host).
        option("port", port).
        option("username", username).
        option("pem", privateKey).
        option("pemPassphrase", privateKeyPhrase).
        option("fileType", "csv").
        option("delimiter", DELIMITER).
        option("header","true").
        option("inferSchema", "true").
        option("nullValue", "").
        option("emptyValue","").
        save(filePath)

Required Output:

id | first_name | middle_name| last_name
1 | Sukanya| S | Pai
2| ABC ||XYZ

If the middle name is blank, then the value should be blank as shown above. but currently, I am getting the below double quotes in the file

id | first_name | middle_name| last_name
1 | Sukanya| S | Pai
2| ABC |""|XYZ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions